Verified compilation.
Added to appropriate .src files.
svn path=/trunk/mcs/; revision=555
public static string MachineName\r
{\r
get\r
- {\r
- // TODO: needs more research/work/thought\r
+ { // TODO: needs more research/work/thought\r
return GetEnvironmentVariable("HOSTNAME");\r
}\r
}\r
{\r
get\r
{\r
- return "\n";\r
+ return PlatformSpecific.NewLine;\r
}\r
}\r
\r
}\r
\r
/// <summary>\r
- /// Get a string containing a trace of the stack\r
+ /// Get StackTrace\r
/// </summary>\r
public static string StackTrace\r
{\r
{\r
get\r
{\r
- return null;\r
+ return GetFolderPath(SpecialFolder.System);\r
}\r
}\r
\r
{\r
get\r
{\r
- return 0;\r
+ return getTickCount();\r
}\r
}\r
\r
/// </summary>\r
public static string GetEnvironmentVariable(string variable)\r
{\r
- return null;\r
+ return getEnvironmentStrings()[variable];\r
}\r
\r
/// <summary>\r
/// Return a set of all environment variables and their values\r
/// </summary>\r
- public static IDictionary GetEnvironmentVariables()\r
+
+ public static IDictionary getEnvironmentStrings()
{\r
- return null;\r
+ // could cache these in a member variable, but that\r
+ // wouldn't be very safe because the environment is\r
+ // dyanamic ya know\r
+ string strEnv = getEnvironment();\r
+ string[] arEnv = strEnv.Split('\t');\r
+ string[] arStr;\r
+ Hashtable ht = new Hashtable();\r
+ foreach(string str in arEnv)\r
+ {\r
+ arStr = str.Split('=', 2);\r
+ switch(arStr.Length)\r
+ {\r
+ case 1:\r
+ ht.Add(arStr[0], "");\r
+ break;\r
+ case 2:\r
+ ht.Add(arStr[0], arStr[1]);\r
+ break;\r
+ default:\r
+ Debug.Assert(false); // this shouldn't happen\r
+ break;\r
+ }\r
+ }\r
+ return ht;
}\r
\r
/// <summary>\r
{\r
return null;\r
}\r
+\r
}\r
}\r
/// </summary>\r
public sealed class OperatingSystem : ICloneable\r
{\r
- private PlatformID itsPlatform;\r
+ private System.PlatformID itsPlatform;\r
private Version itsVersion;\r
\r
public OperatingSystem(PlatformID platform, Version version)\r
throw new ArgumentNullException();\r
}\r
\r
- // the doc doesn't say this, but I would\r
- //if(platform < minPlatform || platform >= maxPlatform)\r
- //{\r
- // throw new ArgumentOutOfRangeException();\r
- // TODO: find out if C# has assertion mechanism\r
- // isn't learning new languages fun? :)\r
- //}\r
-\r
itsPlatform = platform;\r
itsVersion = version;\r
}\r
/// Return hash code\r
/// </summary>\r
public override int GetHashCode()\r
- {\r
+ { // this leave us enuf for 256 unique platforms which should suffice for a good while\r
return ((int)itsPlatform << 24) | itsVersion.GetHashCode() >> 8;\r
}\r
\r
/// </summary>\r
public override string ToString()\r
{\r
- return itsPlatform.ToString() + ", " + itsVersion.ToString();\r
+ string str;\r
+ \r
+ switch(itsPlatform)\r
+ {\r
+ case System.PlatformID.Win32NT: str = "Microsoft Windows NT"; break;\r
+ case System.PlatformID.Win32S: str = "Microsoft Win32S"; break;\r
+ case System.PlatformID.Win32Windows: str = "Microsoft Windows 98"; break;\r
+ case System.PlatformID.Linux86Redhat: str = "Redhat Linux"; break;\r
+ default: str = "<unknown>"; break;\r
+ }\r
+\r
+ return str + " " + itsVersion.ToString();\r
}\r
}\r
}\r
public enum PlatformID\r
{ // TODO: determine what definitions to incorporate\r
// possibilities are quite varied\r
+ // my redhat example is just an idea that\r
+ // can / will be determined at a later date\r
+ // I chose Redhat as an ex since that is the distro I am familiar with\r
Win32NT,\r
Win32S,\r
- Win32Windows\r
+ Win32Windows,\r
+ Linux86Redhat\r
}\r
}
\ No newline at end of file