IndiciumHelper.cs 27 KB

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