public WpdDevice(string deviceId) { var clientInfo = new PortableDeviceTypesLib.PortableDeviceValuesClass(); this.device = new PortableDeviceClass(); this.device.Open(deviceId, (IPortableDeviceValues)clientInfo); this.DeviceID = deviceId; this.device.Content(out this.content); this.Properties = new WpdPropertyCollection(this.Content, this.ObjectID); this.Properties.Refresh(); }
public WpdObject( string objectID, IWpdObject parent, IPortableDeviceContent content ) { this.ObjectID = objectID; this.Parent = parent; this.Content = content; this.Properties = new WpdPropertyCollection( this.Content, this.ObjectID ); this.Properties.Refresh(); var name = this.Properties.Find<string>( PortableDevicePKeys.WPD_OBJECT_NAME, false ); this.Name = name == null ? string.Empty : name.Value; var originalFileName = this.Properties.Find<string>( PortableDevicePKeys.WPD_OBJECT_ORIGINAL_FILE_NAME, false ); this.OriginalFileName = originalFileName == null ? string.Empty : originalFileName.Value; var size = this.Properties.Find<ulong>( PortableDevicePKeys.WPD_OBJECT_SIZE, false ); this.Size = size == null ? 0UL : size.Value; var value = this.Properties.Find<Guid>( PortableDevicePKeys.WPD_OBJECT_CONTENT_TYPE, false ); this.IsContainer = value == null ? false : value.Value == PortableDeviceGuids.WPD_CONTENT_TYPE_FOLDER; }