Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string str2 = "";
- ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Processor");
- UInt32 x;
- foreach (ManagementObject share in searcher.Get())
- {
- foreach (PropertyData PC in share.Properties)
- {
- str2 = PC.Name;
- if (PC.Value != null)
- {
- switch (PC.Value.GetType().ToString())
- {
- case "System.String":
- str2 += " = " + (string)PC.Value;
- break;
- case "System.UInt16":
- ushort shortData = (ushort)PC.Value;
- str2 += "=" + shortData.ToString();
- break;
- case "System.UInt32":
- UInt32 longData = (UInt32)PC.Value;
- str2 += "=" + longData.ToString();
- break;
- default:
- str2 += " = " + (string)PC.Value;
- break;
- }
- }
- Console.WriteLine("\n{0:s}", str2);
- }
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement