ToString() public method

public ToString ( ) : string
return string
Esempio n. 1
0
        public static string GetNombreSistemaOperativo()
        {
            System.OperatingSystem os = System.Environment.OSVersion;
            string osName             = "Unknown";

            switch (os.Platform)
            {
            case System.PlatformID.Win32Windows:
                switch (os.Version.Minor)
                {
                case 0: osName = "Windows 95"; break;

                case 10: osName = "Windows 98"; break;

                case 90: osName = "Windows ME"; break;
                }
                break;

            case System.PlatformID.Win32NT:
                switch (os.Version.Major)
                {
                case 3: osName = "Windws NT 3.51"; break;

                case 4: osName = "Windows NT 4"; break;

                case 5:
                    if (os.Version.Minor == 0)
                    {
                        osName = "Windows 2000";
                    }
                    else if (os.Version.Minor == 1)
                    {
                        osName = "Windows XP";
                    }
                    else if (os.Version.Minor == 2)
                    {
                        osName = "Windows Server 2003";
                    }
                    break;

                case 6:
                    osName = "Otro";
                    if (os.Version.Minor == 0)
                    {
                        osName = "Windows Vista/Windows Server 2008";
                    }
                    else if (os.Version.Minor == 1)
                    {
                        osName = "Windows 7";
                    }
                    else if (os.Version.Minor == 2)
                    {
                        osName = "Windows 8";
                    }
                    break;
                }
                break;
            }
            return(osName + " (" + os.ToString() + ")");
        }
 public void PrintSystemInformation()
 {
     System.OperatingSystem os = System.Environment.OSVersion;
     Console.WriteLine("=====================================================================================");
     Console.WriteLine("{0,-10}: {1}", "Date", DateTime.Now);
     Console.WriteLine("{0,-10}: {1}", "Language", "C#");
     Console.WriteLine("{0,-10}: {1}", "OS", os.ToString());
     Console.WriteLine("=====================================================================================");
 }
Esempio n. 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
            try
            {
                //Application.Run(new Form1());
                //OSの情報(エディションまで)を取得する
                object registry = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", "Release", "Return this default if NoSuchName does not exist.");
                string osinfo   = getOsinfo();
                if (osinfo == null)
                {
                    return;
                }
                //OSの情報を取得する
                else
                {
                    System.OperatingSystem os = System.Environment.OSVersion;
                    if (registry == null)
                    {
                        MessageBox.Show("バージョン4.5以上5未満が存在しません", "フレームワーク情報エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        string registry_str = "";
                        if ((int)registry >= 528040)
                        {
                            registry_str = "4.8以上5.0未満";
                        }
                        else if ((int)registry >= 461808)
                        {
                            registry_str = "4.7.2以上";
                        }
                        else if ((int)registry >= 461308)
                        {
                            registry_str = "4.7.1以上";
                        }
                        else if ((int)registry >= 460798)
                        {
                            registry_str = "4.7以上";
                        }
                        else if ((int)registry >= 394802)
                        {
                            registry_str = "4.6.2以上";
                        }
                        else if ((int)registry >= 394254)
                        {
                            registry_str = "4.6.1以上";
                        }
                        else if ((int)registry >= 393295)
                        {
                            registry_str = "4.6以上";
                        }
                        else if ((int)registry >= 393273)
                        {
                            registry_str = "4.6 RC以上";
                        }
                        else if (((int)registry >= 379893))
                        {
                            registry_str = "4.5.2以上";
                        }
                        else if (((int)registry >= 378675))
                        {
                            registry_str = "4.5.1以上";
                        }
                        else if (((int)registry >= 378389))
                        {
                            registry_str = "4.5以上";
                        }
                        else
                        {
                            registry_str = "No 4.5 or later version detected";
                        }

                        MessageBox.Show("OSの情報↓\n" + os.ToString() + "\n" + osinfo + "\nOSのバージョン↓\n" + os.Version.ToString() + "\nフレームワークのバージョン↓(バージョンは4.5以上です)\n" + registry_str + "\n" + "共通言語ランタイムのバージョン↓\n" + Environment.Version.ToString(),
                                        "OS情報など", MessageBoxButtons.OK);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("例外発生:" + e.Message, "例外", MessageBoxButtons.OK);
            }
        }
Esempio n. 4
0
 public static string ToString(OperatingSystem operatingSystem) {
     return operatingSystem.ToString();
 }
Esempio n. 5
0
 public static string GetOSVersionString()
 {
     System.OperatingSystem infoOS = System.Environment.OSVersion;
     return("versão do sistema operacional: " + infoOS.ToString());
 }
Esempio n. 6
0
 public static void GetOSVersion()
 {
     System.OperatingSystem infoOS = System.Environment.OSVersion;
     Speaker.Speak("versão do sistema operacional " + infoOS.ToString());
 }