コード例 #1
0
        protected Volume(BlockDevice parent, Hal.Manager manager, Hal.Device device) : base(manager, device)
        {
            this.parent = parent ?? BlockDevice.Resolve <IBlockDevice> (manager, device.Parent);

            method_names = HalDevice.PropertyExists(method_names_property)
                ? device.GetPropertyStringList(method_names_property)
                : new string[0];
        }
コード例 #2
0
 public IEnumerator <IVolume> GetEnumerator()
 {
     foreach (Hal.Device hal_device in HalDevice.GetChildrenAsDevice(HalManager))
     {
         Volume volume = Volume.Resolve(this, HalManager, hal_device);
         if (volume != null)
         {
             yield return(volume);
         }
     }
 }
コード例 #3
0
ファイル: UsbDriveInfoLinux.cs プロジェクト: sillsdev/chack
 private static string TryGetDevicePropertyString(HalDevice device, string propertyName)
 {
     //if the property does not exist, we don't care
     try
     {
         return device.GetPropertyString(propertyName);
     }
     catch{}
     return String.Empty;
 }
コード例 #4
0
ファイル: UsbDriveInfoLinux.cs プロジェクト: sillsdev/chack
 private static ulong TryGetDevicePropertyInteger(HalDevice device, string propertyName)
 {
     //if the property does not exist, we don't care
     try
     {
         return device.GetPropertyInteger(propertyName);
     }
     catch { }
     return 0;
 }
コード例 #5
0
ファイル: UsbDriveInfoLinux.cs プロジェクト: sillsdev/chack
 private static bool TryGetDevicePropertyBoolean(HalDevice device, string propertyName)
 {
     //if the property does not exist, we don't care
     try
     {
         return device.GetPropertyBoolean(propertyName);
     }
     catch { }
     return false;
 }
コード例 #6
0
ファイル: UsbDriveInfoLinux.cs プロジェクト: sillsdev/chack
 private static bool DeviceIsOnUsbBus(Connection conn, string halNameOnDbus, HalDevice device)
 {
     bool deviceIsOnUsbSubsystem;
     bool thereIsAPathToParent;
     do
     {
         string subsystem = TryGetDevicePropertyString(device, "info.subsystem");
         deviceIsOnUsbSubsystem = subsystem.Contains("usb");
         string pathToParent = TryGetDevicePropertyString(device, "info.parent");
         thereIsAPathToParent = String.IsNullOrEmpty(pathToParent);
         device = conn.GetObject<HalDevice>(halNameOnDbus, new ObjectPath(pathToParent));
     } while (!deviceIsOnUsbSubsystem && !thereIsAPathToParent);
     return deviceIsOnUsbSubsystem;
 }