Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Miroslav Stampar http://mstampar.awardspace.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Get OS version

   1  
   2   public static string GetMachineOS()
   3   {
   4    if (Environment.OSVersion.Platform == PlatformID.Win32NT)
   5    {
   6     if (Environment.OSVersion.Version.Major<=4)
   7      return String.Format("Windows NT {0}", Environment.OSVersion.Version.ToString());
   8     if (Environment.OSVersion.Version.Major==5)
   9     {
  10      if (Environment.OSVersion.Version.Minor==0)
  11       return String.Format("Windows 2000 {0}", Environment.OSVersion.Version.ToString());
  12      else
  13       return String.Format("Windows XP {0}", Environment.OSVersion.Version.ToString());
  14     }
  15    }
  16     
  17    if (Environment.OSVersion.Platform == PlatformID.Win32Windows)
  18    {
  19     if (Environment.OSVersion.Version.Major>=4)
  20     {
  21      if (Environment.OSVersion.Version.Minor==0)
  22       return String.Format("Windows 95 {0}", Environment.OSVersion.Version.ToString());    
  23      else if (Environment.OSVersion.Version.Minor<90)
  24       return String.Format("Windows 98 {0}", Environment.OSVersion.Version.ToString());
  25      else
  26       return String.Format("Windows Millenim Edition {0}", Environment.OSVersion.Version.ToString());
  27     }
  28    }
  29  
  30    return Environment.OSVersion.ToString(); //ELSE
  31   }
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS