1 //------------------------------------------------------------------------------
\r
3 // System.Environment.cs
\r
5 // Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
\r
7 // Author: Jim Richardson, develop@wtfo-guru.com
\r
8 // Created: Saturday, August 11, 2001
\r
10 //------------------------------------------------------------------------------
\r
13 using System.Collections;
\r
17 public sealed class Environment
\r
19 public enum SpecialFolder
\r
20 { // TODO: Determin if these windoze style folder identifiers
\r
21 // linux counterparts
\r
23 CommonApplicationData,
\r
30 LocalApplicationData,
\r
43 /// Gets the command line for this process
\r
45 public static string CommandLine
\r
54 /// Gets or sets the current directory
\r
56 public static string CurrentDirectory
\r
60 // TODO: needs more research/work/thought
\r
61 return GetEnvironmentVariable("PWD");
\r
69 /// Gets or sets the exit code of this process
\r
71 public static int ExitCode
\r
83 /// Gets the name of the local computer
\r
85 public static string MachineName
\r
89 // TODO: needs more research/work/thought
\r
90 return GetEnvironmentVariable("HOSTNAME");
\r
95 /// Gets the standard new line value
\r
97 public static string NewLine
\r
106 /// Gets the current OS version information
\r
108 public static OperatingSystem OSVersion
\r
117 /// Get a string containing a trace of the stack
\r
119 public static string StackTrace
\r
128 /// Get a fully qualified path to the system directory
\r
130 public static string SystemDirectory
\r
139 /// Get the number of milliseconds that have elapsed since the system was booted
\r
141 public static int TickCount
\r
150 /// Get UserDomainName
\r
152 public static string UserDomainName
\r
161 /// Gets a flag indicating whether the process is in interactive mode
\r
163 public static bool UserInteractive
\r
172 /// Get the user name of current process is running under
\r
174 public static string UserName
\r
178 // TODO: needs more research/work/thought
\r
179 string result = GetEnvironmentVariable("USERNAME");
\r
180 if(result == null || result.Equals(string.Empty))
\r
182 result = GetEnvironmentVariable("USER");
\r
189 /// Get the version of an assembly
\r
191 public static Version Version
\r
200 /// Get the amount of physical memory mapped to process
\r
202 public static long WorkingSet
\r
210 public static void Exit(int exitCode)
\r
215 /// Substitute environment variables in the argument "name"
\r
217 public static string ExpandEnvironmentVariables(string name)
\r
223 /// Return an array of the command line arguments of the current process
\r
225 public static string[] GetCommandLineArgs()
\r
231 /// Return a string containing the value of the environment variable identifed by parameter "variable"
\r
233 public static string GetEnvironmentVariable(string variable)
\r
239 /// Return a set of all environment variables and their values
\r
241 public static IDictionary GetEnvironmentVariables()
\r
247 /// Returns the fully qualified path of the folder specified by the "folder" parameter
\r
249 public static string GetFolderPath(SpecialFolder folder)
\r
255 /// Returns an array of the logical drives
\r
257 public static string[] GetLogicalDrives()
\r