Esempio n. 1
0
        public void get_system_info()
        {
            using (Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0"))
            {
                if (regKey != null)
                {
                    string procName = regKey.GetValue("ProcessorNameString") as string;

                    if (!string.IsNullOrEmpty(procName))
                    {
                        string pros      = System.Text.RegularExpressions.Regex.Replace(procName, @"\s+", " ");
                        string processor = pros.Replace("(R)", "\u00AE");
                        this.label2.Text = processor;
                    }
                    else
                    {
                        this.label2.Text = "Unknown";
                    }
                }
                else
                {
                    this.label2.Text = "Unknown";
                }
            }

            MEMORYSTATUSEX memStatus = new MEMORYSTATUSEX();

            if (GlobalMemoryStatusEx(memStatus))
            {
                this.label3.Text = string.Format("{0} RAM", PCS.ConvertSizeToString(Convert.ToInt64(memStatus.ullTotalPhys)));
            }
            else
            {
                this.label3.Text = "Unknown";
            }

            this.label1.Text = OSVersion.GetOSFriendlyName();

            OperatingSystem OS = Environment.OSVersion;

            if (OS.Version.Major >= 6)
            {
                if (OS.Version.Minor == 0)
                {
                    this.pictureBox1.Image = global::pcsm.Properties.Resources.vista;
                }
                if (OS.Version.Minor >= 1)
                {
                    this.pictureBox1.Image = global::pcsm.Properties.Resources._7;
                }
                if (OS.Version.Minor >= 2)
                {
                    this.pictureBox1.Image = global::pcsm.Properties.Resources._8;
                }
            }
        }