IndiciumHelper.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. using Microsoft.Win32;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Management;
  5. namespace Optimizer
  6. {
  7. public static class IndiciumHelper
  8. {
  9. public static List<Volume> Volumes = new List<Volume>();
  10. public static List<Volume> Opticals = new List<Volume>();
  11. public static List<Volume> Removables = new List<Volume>();
  12. public static List<NetworkDevice> PhysicalAdapters = new List<NetworkDevice>();
  13. public static List<NetworkDevice> VirtualAdapters = new List<NetworkDevice>();
  14. public static List<Keyboard> Keyboards = new List<Keyboard>();
  15. public static List<PointingDevice> PointingDevices = new List<PointingDevice>();
  16. public static List<CPU> GetCPUs()
  17. {
  18. List<CPU> CPUs = new List<CPU>();
  19. CPU cpu;
  20. try
  21. {
  22. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
  23. foreach (ManagementObject mo in searcher.Get())
  24. {
  25. cpu = new CPU();
  26. cpu.Name = Convert.ToString(mo.Properties["Name"].Value);
  27. cpu.L2CacheSize = ByteSize.FromKiloBytes(Convert.ToDouble(mo.Properties["L2CacheSize"].Value));
  28. cpu.L3CacheSize = ByteSize.FromKiloBytes(Convert.ToDouble(mo.Properties["L3CacheSize"].Value));
  29. cpu.Cores = Convert.ToUInt32(mo.Properties["NumberOfCores"].Value);
  30. // ThreadCount is for Windows 10+
  31. //cpu.Threads = Convert.ToUInt32(mo.Properties["ThreadCount"].Value);
  32. cpu.LogicalCpus = Convert.ToUInt32(mo.Properties["NumberOfLogicalProcessors"].Value);
  33. if (Utilities.CurrentWindowsVersion != WindowsVersion.Windows7)
  34. {
  35. bool temp = Convert.ToBoolean(mo.Properties["VirtualizationFirmwareEnabled"].Value);
  36. cpu.Virtualization = (temp) ? "Yes" : "No";
  37. }
  38. else
  39. {
  40. cpu.Virtualization = "-";
  41. }
  42. cpu.Stepping = Convert.ToString(mo.Properties["Description"].Value);
  43. cpu.Revision = Convert.ToString(mo.Properties["Revision"].Value);
  44. try
  45. {
  46. ManagementObjectSearcher searcher2 = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
  47. foreach (ManagementObject mo2 in searcher2.Get())
  48. {
  49. bool temp2 = Convert.ToBoolean(mo2.Properties["DataExecutionPrevention_Available"].Value);
  50. cpu.DataExecutionPrevention = (temp2) ? "Yes" : "No";
  51. }
  52. }
  53. catch
  54. {
  55. cpu.DataExecutionPrevention = "-";
  56. }
  57. if (string.IsNullOrEmpty(cpu.Name)) cpu.Name = GetCPUNameAlternative();
  58. CPUs.Add(cpu);
  59. }
  60. }
  61. catch (Exception ex)
  62. {
  63. Logger.LogError("IndiciumHelper.GetCPUs", ex.Message, ex.StackTrace);
  64. }
  65. return CPUs;
  66. }
  67. private static string GetCPUNameAlternative()
  68. {
  69. using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0", false))
  70. {
  71. return key.GetValue("ProcessorNameString").ToString();
  72. }
  73. }
  74. public static VirtualMemory GetVM()
  75. {
  76. VirtualMemory vm = new VirtualMemory();
  77. try
  78. {
  79. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
  80. foreach (ManagementObject mo in searcher.Get())
  81. {
  82. vm.TotalVirtualMemory = ByteSize.FromKiloBytes(Convert.ToUInt64(mo.Properties["TotalVirtualMemorySize"].Value));
  83. vm.AvailableVirtualMemory = ByteSize.FromKiloBytes(Convert.ToUInt64(mo.Properties["FreeVirtualMemory"].Value));
  84. vm.UsedVirtualMemory = vm.TotalVirtualMemory.Subtract(vm.AvailableVirtualMemory);
  85. }
  86. }
  87. catch (Exception ex)
  88. {
  89. Logger.LogError("IndiciumHelper.GetVM", ex.Message, ex.StackTrace);
  90. }
  91. return vm;
  92. }
  93. public static List<RAM> GetRAM()
  94. {
  95. List<RAM> modules = new List<RAM>();
  96. RAM module;
  97. try
  98. {
  99. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMemory");
  100. foreach (ManagementObject mo in searcher.Get())
  101. {
  102. module = new RAM();
  103. module.BankLabel = Convert.ToString(mo.Properties["BankLabel"].Value);
  104. module.Capacity = ByteSize.FromBytes(Convert.ToDouble(mo.Properties["Capacity"].Value));
  105. module.Manufacturer = Convert.ToString(mo.Properties["Manufacturer"].Value);
  106. module.Speed = Convert.ToUInt32(mo.Properties["Speed"].Value);
  107. UInt16 memorytype = Convert.ToUInt16(mo.Properties["MemoryType"].Value);
  108. UInt16 formfactor = Convert.ToUInt16(mo.Properties["FormFactor"].Value);
  109. module.MemoryType = SanitizeMemoryType(memorytype);
  110. module.FormFactor = SanitizeFormFactor(formfactor);
  111. modules.Add(module);
  112. }
  113. }
  114. catch (Exception ex)
  115. {
  116. Logger.LogError("IndiciumHelper.GetRAM", ex.Message, ex.StackTrace);
  117. }
  118. return modules;
  119. }
  120. public static List<Motherboard> GetMotherboards()
  121. {
  122. List<Motherboard> mobos = new List<Motherboard>();
  123. try
  124. {
  125. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
  126. foreach (ManagementObject mo in searcher.Get())
  127. {
  128. Motherboard mobo = new Motherboard();
  129. mobo.Model = Convert.ToString(mo.Properties["Model"].Value);
  130. mobo.Manufacturer = Convert.ToString(mo.Properties["Manufacturer"].Value);
  131. mobo.Product = Convert.ToString(mo.Properties["Product"].Value);
  132. mobo.Version = Convert.ToString(mo.Properties["Version"].Value);
  133. try
  134. {
  135. ManagementObjectSearcher searcher2 = new ManagementObjectSearcher("SELECT * FROM Win32_IDEController");
  136. foreach (ManagementObject mo2 in searcher2.Get())
  137. {
  138. mobo.Chipset = Convert.ToString(mo2.Properties["Description"].Value);
  139. }
  140. }
  141. catch { }
  142. try
  143. {
  144. ManagementObjectSearcher searcher3 = new ManagementObjectSearcher("SELECT * FROM Win32_IDEController");
  145. foreach (ManagementObject mo3 in searcher3.Get())
  146. {
  147. mobo.Revision = Convert.ToString(mo3.Properties["RevisionNumber"].Value);
  148. }
  149. }
  150. catch { }
  151. try
  152. {
  153. ManagementObjectSearcher searcher4 = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
  154. foreach (ManagementObject mo4 in searcher4.Get())
  155. {
  156. mobo.SystemModel = Convert.ToString(mo4.Properties["Model"].Value);
  157. }
  158. }
  159. catch { }
  160. ManagementObjectSearcher searcher5 = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
  161. foreach (ManagementObject mo5 in searcher5.Get())
  162. {
  163. mobo.BIOSName = Convert.ToString(mo5.Properties["Name"].Value);
  164. mobo.BIOSManufacturer = Convert.ToString(mo5.Properties["Manufacturer"].Value);
  165. mobo.BIOSVersion = Convert.ToString(mo5.Properties["Version"].Value);
  166. mobo.BIOSBuildNumber = Convert.ToString(mo5.Properties["BuildNumber"].Value);
  167. //ReleaseDate = DateTime.Parse(mo.Properties["ReleaseDate"].Value.ToString());
  168. }
  169. mobos.Add(mobo);
  170. }
  171. }
  172. catch (Exception ex)
  173. {
  174. Logger.LogError("IndiciumHelper.GetMotherboards", ex.Message, ex.StackTrace);
  175. }
  176. return mobos;
  177. }
  178. public static List<Disk> GetDisks()
  179. {
  180. List<Disk> disks = new List<Disk>();
  181. try
  182. {
  183. ManagementObjectSearcher searcher2 = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
  184. foreach (ManagementObject mo2 in searcher2.Get())
  185. {
  186. Disk disk = new Disk();
  187. disk.Model = Convert.ToString(mo2.Properties["Model"].Value);
  188. disk.BytesPerSector = Convert.ToUInt32(mo2.Properties["BytesPerSector"].Value);
  189. disk.FirmwareRevision = Convert.ToString(mo2.Properties["FirmwareRevision"].Value);
  190. disk.MediaType = Convert.ToString(mo2.Properties["MediaType"].Value);
  191. disk.Capacity = ByteSize.FromBytes(Convert.ToDouble(mo2.Properties["Size"].Value));
  192. disks.Add(disk);
  193. }
  194. }
  195. catch (Exception ex)
  196. {
  197. Logger.LogError("IndiciumHelper.GetDisks", ex.Message, ex.StackTrace);
  198. }
  199. return disks;
  200. }
  201. public static void GetVolumes()
  202. {
  203. try
  204. {
  205. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Volume");
  206. foreach (ManagementObject mo in searcher.Get())
  207. {
  208. Volume volume = new Volume();
  209. volume.BlockSize = Convert.ToUInt64(mo.Properties["BlockSize"].Value);
  210. volume.Capacity = ByteSize.FromBytes(Convert.ToDouble(mo.Properties["Capacity"].Value));
  211. bool temp = Convert.ToBoolean(mo.Properties["Compressed"].Value);
  212. volume.Compressed = (temp) ? "Yes" : "No";
  213. volume.DriveLetter = Convert.ToString(mo.Properties["DriveLetter"].Value);
  214. UInt32 i = Convert.ToUInt32(mo.Properties["DriveType"].Value);
  215. volume.DriveType = SanitizeDriveType(i);
  216. volume.FileSystem = Convert.ToString(mo.Properties["FileSystem"].Value);
  217. volume.FreeSpace = ByteSize.FromBytes(Convert.ToDouble(mo.Properties["FreeSpace"].Value));
  218. volume.UsedSpace = volume.Capacity.Subtract(volume.FreeSpace);
  219. bool temp2 = Convert.ToBoolean(mo.Properties["IndexingEnabled"].Value);
  220. volume.Indexing = (temp2) ? "Yes" : "No";
  221. volume.Label = Convert.ToString(mo.Properties["Label"].Value);
  222. if (i == 2)
  223. {
  224. Removables.Add(volume);
  225. }
  226. else if (i == 5)
  227. {
  228. Opticals.Add(volume);
  229. }
  230. else
  231. {
  232. Volumes.Add(volume);
  233. }
  234. }
  235. }
  236. catch (Exception ex)
  237. {
  238. Logger.LogError("IndiciumHelper.GetVolumes", ex.Message, ex.StackTrace);
  239. }
  240. }
  241. public static void GetPeripherals()
  242. {
  243. try
  244. {
  245. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Keyboard");
  246. foreach (ManagementObject mo in searcher.Get())
  247. {
  248. Keyboard keyboard = new Keyboard();
  249. keyboard.Name = Convert.ToString(mo.Properties["Description"].Value);
  250. keyboard.Layout = Convert.ToString(mo.Properties["Layout"].Value);
  251. keyboard.Status = Convert.ToString(mo.Properties["Status"].Value);
  252. keyboard.FunctionKeys = Convert.ToUInt16(mo.Properties["NumberOfFunctionKeys"].Value);
  253. bool temp = Convert.ToBoolean(mo.Properties["IsLocked"].Value);
  254. keyboard.Locked = (temp) ? "Yes" : "No";
  255. Keyboards.Add(keyboard);
  256. }
  257. }
  258. catch (Exception ex)
  259. {
  260. Logger.LogError("IndiciumHelper.GetKeyboards", ex.Message, ex.StackTrace);
  261. }
  262. try
  263. {
  264. ManagementObjectSearcher searcher2 = new ManagementObjectSearcher("SELECT * FROM Win32_PointingDevice");
  265. foreach (ManagementObject mo2 in searcher2.Get())
  266. {
  267. PointingDevice pointingDevice = new PointingDevice();
  268. pointingDevice.Name = Convert.ToString(mo2.Properties["Description"].Value);
  269. pointingDevice.Manufacturer = Convert.ToString(mo2.Properties["Manufacturer"].Value);
  270. pointingDevice.Status = Convert.ToString(mo2.Properties["Status"].Value);
  271. pointingDevice.Buttons = Convert.ToUInt16(mo2.Properties["NumberOfButtons"].Value);
  272. bool temp = Convert.ToBoolean(mo2.Properties["IsLocked"].Value);
  273. pointingDevice.Locked = (temp) ? "Yes" : "No";
  274. pointingDevice.HardwareType = Convert.ToString(mo2.Properties["HardwareType"].Value);
  275. UInt16 i = Convert.ToUInt16(mo2.Properties["PointingType"].Value);
  276. pointingDevice.PointingType = SanitizePointingType(i);
  277. UInt16 i2 = Convert.ToUInt16(mo2.Properties["DeviceInterface"].Value);
  278. pointingDevice.DeviceInterface = SanitizeDeviceInterface(i2);
  279. PointingDevices.Add(pointingDevice);
  280. }
  281. }
  282. catch (Exception ex)
  283. {
  284. Logger.LogError("IndiciumHelper.GetPointingDevices", ex.Message, ex.StackTrace);
  285. }
  286. }
  287. public static List<GPU> GetGPUs()
  288. {
  289. List<GPU> GPUs = new List<GPU>();
  290. try
  291. {
  292. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
  293. foreach (ManagementObject mo in searcher.Get())
  294. {
  295. GPU gpu = new GPU();
  296. gpu.Name = Convert.ToString(mo.Properties["Name"].Value);
  297. gpu.Memory = ByteSize.FromBytes(Convert.ToDouble(mo.Properties["AdapterRAM"].Value));
  298. gpu.ResolutionX = Convert.ToUInt32(mo.Properties["CurrentHorizontalResolution"].Value);
  299. gpu.ResolutionY = Convert.ToUInt32(mo.Properties["CurrentVerticalResolution"].Value);
  300. gpu.RefreshRate = Convert.ToUInt32(mo.Properties["CurrentRefreshRate"].Value);
  301. gpu.DACType = Convert.ToString(mo.Properties["AdapterDACType"].Value);
  302. UInt16 vtype = Convert.ToUInt16(mo.Properties["VideoMemoryType"].Value);
  303. gpu.VideoMemoryType = SanitizeVideoMemoryType(vtype);
  304. GPUs.Add(gpu);
  305. }
  306. }
  307. catch (Exception ex)
  308. {
  309. Logger.LogError("IndiciumHelper.GetGPUs", ex.Message, ex.StackTrace);
  310. }
  311. return GPUs;
  312. }
  313. public static void GetNetworkAdapters()
  314. {
  315. try
  316. {
  317. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter");
  318. foreach (ManagementObject mo in searcher.Get())
  319. {
  320. NetworkDevice adapter = new NetworkDevice();
  321. adapter.AdapterType = Convert.ToString(mo.Properties["AdapterType"].Value);
  322. adapter.Manufacturer = Convert.ToString(mo.Properties["Manufacturer"].Value);
  323. adapter.ProductName = Convert.ToString(mo.Properties["ProductName"].Value);
  324. bool temp = Convert.ToBoolean(mo.Properties["PhysicalAdapter"].Value);
  325. adapter.PhysicalAdapter = (temp) ? "Yes" : "No";
  326. adapter.MacAddress = Convert.ToString(mo.Properties["MacAddress"].Value);
  327. adapter.ServiceName = Convert.ToString(mo.Properties["ServiceName"].Value);
  328. if (temp)
  329. {
  330. PhysicalAdapters.Add(adapter);
  331. }
  332. else
  333. {
  334. VirtualAdapters.Add(adapter);
  335. }
  336. }
  337. }
  338. catch (Exception ex)
  339. {
  340. Logger.LogError("IndiciumHelper.GetNetworkAdapters", ex.Message, ex.StackTrace);
  341. }
  342. }
  343. public static List<AudioDevice> GetAudioDevices()
  344. {
  345. List<AudioDevice> audioDevices = new List<AudioDevice>();
  346. try
  347. {
  348. ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_SoundDevice");
  349. foreach (ManagementObject mo in searcher.Get())
  350. {
  351. AudioDevice device = new AudioDevice();
  352. device.ProductName = Convert.ToString(mo.Properties["ProductName"].Value);
  353. device.Manufacturer = Convert.ToString(mo.Properties["Manufacturer"].Value);
  354. device.Status = Convert.ToString(mo.Properties["Status"].Value);
  355. audioDevices.Add(device);
  356. }
  357. }
  358. catch (Exception ex)
  359. {
  360. Logger.LogError("IndiciumHelper.GetAudioDevices", ex.Message, ex.StackTrace);
  361. }
  362. return audioDevices;
  363. }
  364. private static string SanitizeDriveType(UInt32 i)
  365. {
  366. string result = string.Empty;
  367. switch (i)
  368. {
  369. case 0:
  370. result = "Unknown";
  371. break;
  372. case 1:
  373. result = "No Root Directory";
  374. break;
  375. case 2:
  376. result = "Removable Disk";
  377. break;
  378. case 3:
  379. result = "Local Disk";
  380. break;
  381. case 4:
  382. result = "Network Drive";
  383. break;
  384. case 5:
  385. result = "Compact Disk";
  386. break;
  387. case 6:
  388. result = "RAM Disk";
  389. break;
  390. }
  391. return result;
  392. }
  393. private static string SanitizeVideoMemoryType(UInt16 i)
  394. {
  395. string result = string.Empty;
  396. switch (i)
  397. {
  398. case 1:
  399. result = "Other";
  400. break;
  401. case 2:
  402. result = "Unknown";
  403. break;
  404. case 3:
  405. result = "VRAM";
  406. break;
  407. case 4:
  408. result = "DRAM";
  409. break;
  410. case 5:
  411. result = "SRAM";
  412. break;
  413. case 6:
  414. result = "WRAM";
  415. break;
  416. case 7:
  417. result = "EDO RAM";
  418. break;
  419. case 8:
  420. result = "Burst Synchronous DRAM";
  421. break;
  422. case 9:
  423. result = "Pipelined Burst SRAM";
  424. break;
  425. case 10:
  426. result = "CDRAM";
  427. break;
  428. case 11:
  429. result = "3DRAM";
  430. break;
  431. case 12:
  432. result = "SDRAM";
  433. break;
  434. case 13:
  435. result = "SGRAM";
  436. break;
  437. }
  438. return result;
  439. }
  440. private static string SanitizeFormFactor(UInt16 i)
  441. {
  442. string result = string.Empty;
  443. switch (i)
  444. {
  445. case 0:
  446. result = "Unknown";
  447. break;
  448. case 1:
  449. result = "Other";
  450. break;
  451. case 2:
  452. result = "SIP";
  453. break;
  454. case 3:
  455. result = "DIP";
  456. break;
  457. case 4:
  458. result = "ZIP";
  459. break;
  460. case 5:
  461. result = "SOJ";
  462. break;
  463. case 6:
  464. result = "Proprietary";
  465. break;
  466. case 7:
  467. result = "SIMM";
  468. break;
  469. case 8:
  470. result = "DIMM";
  471. break;
  472. case 9:
  473. result = "TSOP";
  474. break;
  475. case 10:
  476. result = "PGA";
  477. break;
  478. case 11:
  479. result = "RIMM";
  480. break;
  481. case 12:
  482. result = "SODIMM";
  483. break;
  484. case 13:
  485. result = "SRIMM";
  486. break;
  487. case 14:
  488. result = "SMD";
  489. break;
  490. case 15:
  491. result = "SSMP";
  492. break;
  493. case 16:
  494. result = "QFP";
  495. break;
  496. case 17:
  497. result = "TQFP";
  498. break;
  499. case 18:
  500. result = "SOIC";
  501. break;
  502. case 19:
  503. result = "LCC";
  504. break;
  505. case 20:
  506. result = "PLCC";
  507. break;
  508. case 21:
  509. result = "BGA";
  510. break;
  511. case 22:
  512. result = "FPBGA";
  513. break;
  514. case 23:
  515. result = "LGA";
  516. break;
  517. }
  518. return result;
  519. }
  520. private static string SanitizeMemoryType(UInt16 i)
  521. {
  522. string result = string.Empty;
  523. switch (i)
  524. {
  525. case 0:
  526. result = "Unknown";
  527. break;
  528. case 1:
  529. result = "Other";
  530. break;
  531. case 2:
  532. result = "DRAM";
  533. break;
  534. case 3:
  535. result = "Synchonous DRAM";
  536. break;
  537. case 4:
  538. result = "Cache DRAM";
  539. break;
  540. case 5:
  541. result = "EDO";
  542. break;
  543. case 6:
  544. result = "EDRAM";
  545. break;
  546. case 7:
  547. result = "VRAM";
  548. break;
  549. case 8:
  550. result = "SRAM";
  551. break;
  552. case 9:
  553. result = "RAM";
  554. break;
  555. case 10:
  556. result = "ROM";
  557. break;
  558. case 11:
  559. result = "Flash";
  560. break;
  561. case 12:
  562. result = "EEPROM";
  563. break;
  564. case 13:
  565. result = "FEPROM";
  566. break;
  567. case 14:
  568. result = "EPROM";
  569. break;
  570. case 15:
  571. result = "CDRAM";
  572. break;
  573. case 16:
  574. result = "3DRAM";
  575. break;
  576. case 17:
  577. result = "SDRAM";
  578. break;
  579. case 18:
  580. result = "SGRAM";
  581. break;
  582. case 19:
  583. result = "RDRAM";
  584. break;
  585. case 20:
  586. result = "DDR";
  587. break;
  588. case 21:
  589. result = "DDR2";
  590. break;
  591. case 22:
  592. result = "DDR2 FB-DIMM";
  593. break;
  594. case 24:
  595. result = "DDR3";
  596. break;
  597. case 25:
  598. result = "FBD2";
  599. break;
  600. }
  601. return result;
  602. }
  603. private static string SanitizeDeviceInterface(UInt16 i)
  604. {
  605. string result = string.Empty;
  606. switch (i)
  607. {
  608. case 1:
  609. result = "Other";
  610. break;
  611. case 2:
  612. result = "Unknown";
  613. break;
  614. case 3:
  615. result = "Serial";
  616. break;
  617. case 4:
  618. result = "PS/2";
  619. break;
  620. case 5:
  621. result = "Infrared";
  622. break;
  623. case 6:
  624. result = "HP-HIL";
  625. break;
  626. case 7:
  627. result = "Bus mouse";
  628. break;
  629. case 8:
  630. result = "ADB (Apple Desktop Bus)";
  631. break;
  632. case 160:
  633. result = "Bus mouse DB-9";
  634. break;
  635. case 161:
  636. result = "Bus mouse micro-DIN";
  637. break;
  638. case 162:
  639. result = "USB";
  640. break;
  641. }
  642. return result;
  643. }
  644. private static string SanitizePointingType(UInt16 i)
  645. {
  646. string result = string.Empty;
  647. switch (i)
  648. {
  649. case 1:
  650. result = "Other";
  651. break;
  652. case 2:
  653. result = "Unknown";
  654. break;
  655. case 3:
  656. result = "Mouse";
  657. break;
  658. case 4:
  659. result = "Track Ball";
  660. break;
  661. case 5:
  662. result = "Track Point";
  663. break;
  664. case 6:
  665. result = "Glide Point";
  666. break;
  667. case 7:
  668. result = "Touch Pad";
  669. break;
  670. case 8:
  671. result = "Touch Screen";
  672. break;
  673. case 9:
  674. result = "Mouse - Optical Sensor";
  675. break;
  676. }
  677. return result;
  678. }
  679. }
  680. }