IndiciumHelper.cs 26 KB

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