Exemple #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];
        }
Exemple #2
0
 private IEnumerable <T> GetAllBlockDevices <T> () where T : IBlockDevice
 {
     foreach (Hal.Device hal_device in manager.FindDeviceByCapabilityAsDevice("block"))
     {
         IBlockDevice device = BlockDevice.Resolve <T> (manager, hal_device);
         if (device != null)
         {
             yield return((T)device);
         }
     }
 }
Exemple #3
0
        public static Volume Resolve(BlockDevice parent, Hal.Manager manager, Hal.Device device)
        {
            if (!device.IsVolume)
            {
                return(null);
            }

            try {
                Volume volume = (parent is ICdromDevice || (parent == null && device.QueryCapability("volume.disc")))
                    ? DiscVolume.Resolve(parent, manager, device)
                    : new Volume(parent, manager, device);

                return(CheckVolumeMounted(volume) ? volume : null);
            } catch (Exception e) {
                Hyena.Log.Exception(e);
            }

            return(null);
        }
Exemple #4
0
        private IDevice Resolve(Hal.Device hal_device)
        {
            if (!hal_device.QueryCapability("block") && !hal_device.QueryCapability("portable_audio_player"))
            {
                return(null);
            }

            IDevice device = BlockDevice.Resolve <IBlockDevice> (manager, hal_device);

            if (device == null)
            {
                device = Volume.Resolve(null, manager, hal_device);
                if (device == null)
                {
                    device = new Device(manager, hal_device);
                }
            }

            return(device);
        }
Exemple #5
0
 private DiscVolume(BlockDevice parent, Hal.Manager manager, Hal.Device device) : base(parent, manager, device)
 {
 }
Exemple #6
0
 public new static DiscVolume Resolve(BlockDevice parent, Hal.Manager manager, Hal.Device device)
 {
     return(device.QueryCapability("volume.disc") ? new DiscVolume(parent, manager, device) : null);
 }