示例#1
0
        private void AddMachineInformation(List <string> extra)
        {
            extra.Add("Machine information:");

            // Processor
            List <string> cpuNames = WMI.Processor_Name();

            foreach (string s in cpuNames)
            {
                extra.Add(string.Format("- Processor: {0}", s));
            }

            List <string> clockspeed = WMI.Processor_MaxClockSpeed();

            foreach (string s in clockspeed)
            {
                extra.Add(string.Format("- Processor clock speed: {0} MHz", s));
            }

            extra.Add(string.Format("- Logical processors: {0}", Environment.ProcessorCount));
            extra.Add(string.Format("- Physical memory: {0:0.000} GB", WMI.PhysicalMemory_Capacity()));
            extra.Add(string.Format("- OS version: {0}", Environment.OSVersion));

            // Physical disks
            List <PhysicalDisk> disks = WMI.PhysicalDisks();

            foreach (PhysicalDisk disk in disks)
            {
                extra.Add(string.Format("- Disk: {0}", disk.Model));
                extra.Add(string.Format("    Type: {0}", disk.Type));
                extra.Add(string.Format("    Interface: {0}", disk.InterfaceType));
                extra.Add(string.Format("    Size: {0:0.000} GB", disk.Size));
            }

            List <LogicalDisk> logicalDisks = WMI.LogicalDisks();

            foreach (LogicalDisk disk in logicalDisks)
            {
                if (disk.Size == 0)
                {
                    continue;
                }

                extra.Add(string.Format("- Partition: {0}", disk.Caption));
                extra.Add(string.Format("    Type: {0}", disk.DriveType.ToString()));
                extra.Add(string.Format("    File System: {0}", disk.FileSystem));
                extra.Add(string.Format("    Size: {0:0.000} GB", disk.Size));
                extra.Add(string.Format("    Free space: {0:0.000} GB", disk.Free));
            }
        }