Esempio n. 1
0
        private void assingPartitionInfo(UsbStore usb, ManagementObject searchPartition)
        {
            string partitionDeviceId          = searchPartition[KEY_PARTITION_DEVICE_ID].ToString();
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(String.Format(QUERY_LOGICAL_DISK_TO_PARTITION, partitionDeviceId));

            foreach (ManagementObject search in searcher.Get())
            {
                usb.setPath(assingPath(search));
            }
        }
Esempio n. 2
0
        private UsbStore buildUsbStore(ManagementObject search)
        {
            UsbStore usb = new UsbStore();

            usb.setModel(assingModel(search));
            usb.setSerialNumber(assingSerialNumber(search));
            usb.setSize(assingSize(search));

            string diskDeviceId = search[KEY_DISK_DEVICE_ID].ToString();
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(String.Format(QUERY_DISK_TO_PARTITION, diskDeviceId));

            foreach (ManagementObject searchPartition in searcher.Get())
            {
                assingPartitionInfo(usb, searchPartition);
            }
            return(usb);
        }