Ejemplo n.º 1
0
        /// <summary>
        /// Gets information about the operating system.
        /// </summary>
        public static OperatingSystemInfo GetOperatingSystem()
        {
            OperatingSystemInfo system = null;

            ManagementObjectSearcher processorQuery = new ManagementObjectSearcher(

                @"SELECT
                        Caption              
                    FROM Win32_OperatingSystem"
                );

            try
            {
                ManagementObjectCollection processorInfo = processorQuery.Get();

                system         = new OperatingSystemInfo();
                system.Is64bit = Environment.Is64BitOperatingSystem;

                foreach (ManagementObject item in processorInfo)
                {
                    system.Name = item["Caption"].ToString();
                }
            }
            catch (Exception exc)
            {
                Logger.Error("GetOperatingSystem() error...", exc);
                system = null;
            }

            return(system);
        }
Ejemplo n.º 2
0
        public static JsonObjectCollection ConvertToJson(OperatingSystemInfo operatingSystem)
        {
            JsonObjectCollection jsonOS = new JsonObjectCollection("OperatingSystem");

            jsonOS.Add(new JsonStringValue("Name", operatingSystem.Name));
            jsonOS.Add(new JsonBooleanValue("Is64Bit", operatingSystem.Is64bit));

            return(jsonOS);
        }
Ejemplo n.º 3
0
        private void PopulateHardwareInfo()
        {
            Configuration = SystemUtils.GetComputerConfiguration();

            OperatingSystemInfo      operatingSystem = Configuration.OperatingSystem;
            List <CpuInfo>           processors      = Configuration.Processors;
            List <RamInfo>           memory          = Configuration.MemoryModules;
            List <StorageDeviceInfo> storage         = Configuration.StorageDevices;

            // OS
            txtBoxOsName.Text = operatingSystem.Name;
            txtBoxOsType.Text = operatingSystem.Is64bit ? "64 bit" : "32 bit";

            // CPU
            CpuInfo cpu = processors.First();

            txtBoxCpuName.Text      = cpu.Name;
            txtBoxCpuFrequency.Text = String.Format("{0} MHz", cpu.MaxClockSpeed);
            txtBoxCpuThreads.Text   = cpu.Threads.ToString();
            txtBoxCpuCount.Text     = processors.Count.ToString();

            // RAM
            RamInfo ram = memory.First();

            int capacity = 0;

            foreach (var bank in memory)
            {
                capacity += bank.Capacity;
            }

            txtBoxMemoryCapacity.Text  = String.Format("{0} GB", capacity);
            txtBoxMemoryType.Text      = ram.MemoryType.ToString();
            txtBoxMemoryFrequency.Text = String.Format("{0} MHz", ram.Speed);
            txtBoxMemoryBanks.Text     = memory.Count.ToString();

            // STORAGE
            string            benchmarkDataDirectoryRoot = Path.GetPathRoot(BenchmarkTests.First().Database.DataDirectory);
            StorageDeviceInfo dataDrive = storage.Find(drive => drive.DriveLetters.Contains(benchmarkDataDirectoryRoot.Trim('\\')));

            comboBoxStorageModel.Items.AddRange(storage.Select(device => device.Model).ToArray());
            int selectedIndex = comboBoxStorageModel.Items.IndexOf(dataDrive.Model);

            comboBoxStorageModel.SelectedIndex = selectedIndex;

            txtBoxHddSize.Text = String.Format("{0} GB", dataDrive.Size);
        }
Ejemplo n.º 4
0
        public static JsonObjectCollection ConvertToJson(OperatingSystemInfo operatingSystem)
        {
            JsonObjectCollection jsonOS = new JsonObjectCollection("OperatingSystem");
            jsonOS.Add(new JsonStringValue("Name", operatingSystem.Name));
            jsonOS.Add(new JsonBooleanValue("Is64Bit", operatingSystem.Is64bit));

            return jsonOS;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets information about the operating system.
        /// </summary>
        public static OperatingSystemInfo GetOperatingSystem()
        {
            OperatingSystemInfo system = null;

            ManagementObjectSearcher processorQuery = new ManagementObjectSearcher(

                   @"SELECT
                        Caption
                    FROM Win32_OperatingSystem"
            );

            try
            {
                ManagementObjectCollection processorInfo = processorQuery.Get();

                system = new OperatingSystemInfo();
                system.Is64bit = Environment.Is64BitOperatingSystem;

                foreach (ManagementObject item in processorInfo)
                    system.Name = item["Caption"].ToString();
            }
            catch (Exception exc)
            {
                Logger.Error("GetOperatingSystem() error...", exc);
                system = null;
            }

            return system;
        }