Implemented additional functionality.
[mono.git] / mcs / class / corlib / System / OperatingSystem.cs
index f5d92202fae7b4593d33e4d5d201f53ca37a5acb..bc5b0c4cccad4c71be6b7756db7793528a3fc57a 100644 (file)
@@ -18,7 +18,7 @@ namespace System
        /// </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
@@ -28,14 +28,6 @@ namespace System
                                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
@@ -86,7 +78,7 @@ namespace System
                /// 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
@@ -95,7 +87,18 @@ namespace System
                /// </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