public static void WriteObject(IPortableDevicePropVariantCollection collection) { uint num = 0; collection.GetCount(ref num); for (uint index = 0; index < num; index++) { PROPVARIANT val = new PROPVARIANT(); collection.GetAt(index, ref val); Trace.WriteLine($"##### {((PropVariant)val).ToString()}"); } }
public void Delete(bool recursive = false) { var objectIdCollection = (IPortableDevicePropVariantCollection) new PortableDeviceTypesLib.PortableDevicePropVariantCollection(); var propVariantValue = PropVariant.StringToPropVariant(this.Id); objectIdCollection.Add(ref propVariantValue); IPortableDevicePropVariantCollection results = (PortableDeviceApiLib.IPortableDevicePropVariantCollection) new PortableDevicePropVariantCollection(); // TODO: get the results back and handle failures correctly this.device.deviceContent.Delete(recursive ? PORTABLE_DEVICE_DELETE_WITH_RECURSION : PORTABLE_DEVICE_DELETE_NO_RECURSION, objectIdCollection, null); ComTrace.WriteObject(objectIdCollection); }
public void Delete(IEnumerable <PortableDeviceObject> objects, DeleteObjectOptions opts = DeleteObjectOptions.NO_RECURSION) { IPortableDeviceContent content; portableDeviceClass.Content(out content); var objectIds = (IPortableDevicePropVariantCollection) new PortableDevicePropVariantCollection(); foreach (var obj in objects) { tag_inner_PROPVARIANT propvarValue; ConvertObjectsIdToPropVariant(obj, out propvarValue); objectIds.Add(propvarValue); } IPortableDevicePropVariantCollection results = null; content.Delete((uint)opts, objectIds, ref results); }
public void Add(PropertyKey key, IPortableDevicePropVariantCollection value) { this.values.SetIPortableDevicePropVariantCollectionValue(key, value); }