[Mono-list] Implementation of 'System.Runtime.InteropServices.RuntimeEnvironment.cs'

Dominik Fretz lists@roboto.ch
Fri, 25 Apr 2003 00:02:25 +0200


This is a multi-part message in MIME format.
--------------020102010500000602050009
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi

As for helping the proting work of #D, i found the not implemented 
class: System.Runtime.InteropServices.RuntimeEnvironment.cs

Find attachted a first version of this class.

I talked with Miguel on IRC about it, and its based on his ideas.
The property: SystemConfigurationFile isnt implemented it. I didn't know 
what path it returns (have to check it at company on a windows box). 
Currently it return String.Empty;

Also the function FromGlobalAccessCache(Assembly a) isnt implemented it. 
It throws a NotImplementedException.

GetSystemVersion() return currently the fixed string: "v1.1.4322"
This seams to be the version string of the .Net 1.1 framework.

The class compiles with the current cvs. Didn't checked it agains 
another version.

If the class is OK for you, someone could please add it to cvs.

Also please add the line: 
'System.Runtime.InteropServices/RuntimeEnvironment.cs'  to the file: 
mcs/class/corlib/unix.args  so the new class gets compiled.

thank you

Regards

Dominik

--------------020102010500000602050009
Content-Type: text/plain;
 name="RuntimeEnvironment.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="RuntimeEnvironment.cs"


// System.Runtime.InteropServices/RuntimeEnvironment.cs
//
// Dominik Fretz (roboto@gmx.net)
//
// (C) 2003 Dominik Fretz

using System;
using System.Reflection;

namespace  System.Runtime.InteropServices
{

	class RuntimeEnvironment
	{
		public RuntimeEnvironment()
		{
		}

		[MonoTODO]
		public static string SystemConfigurationFile 
		{
			get { return String.Empty; }
		}

		
		[MonoTODO]
		public static bool FromGlobalAccessCache( Assembly a)
		{
			throw new NotImplementedException ();
		}

	
		public static string GetRuntimeDirectory()
		{
			string result = String.Empty;
                        Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
			
			foreach (Assembly a in assemblies)
			{
				string codebase = a.Location;
				if (codebase.EndsWith ("corlib.dll"))
				{
					result = codebase.Substring (0, codebase.LastIndexOf (System.IO.Path.DirectorySeparatorChar));
				}
			}
	
			return result;
		}

		public static string GetSystemVersion()
		{
			//TODO We give back the .Net (1.1) version nummber. Probabbly Environment.Version should also return this.
			return "v1.1.4322";
		}
		
	}
}

--------------020102010500000602050009--