/// <summary> /// Update service /// </summary> protected virtual void Update() { this.content.Properties(out IPortableDeviceProperties properties); properties.GetSupportedProperties(this.ServiceObjectID, out IPortableDeviceKeyCollection keyCol); properties.GetValues(this.ServiceObjectID, keyCol, out IPortableDeviceValues deviceValues); ComTrace.WriteObject(deviceValues); }
internal virtual void UpdateProperties() { this.service.content.Properties(out IPortableDeviceProperties properties); //IPortableDeviceKeyCollection keyCol = (IPortableDeviceKeyCollection)new PortableDeviceKeyCollection(); properties.GetSupportedProperties(this.ObjectId, out IPortableDeviceKeyCollection keyCol); properties.GetValues(this.ObjectId, keyCol, out IPortableDeviceValues deviceValues); using (PropVariantFacade value = new PropVariantFacade()) { deviceValues.GetValue(ref WPD.ParentId, out value.Value); this.ParentId = value; } using (PropVariantFacade value = new PropVariantFacade()) { deviceValues.GetValue(ref WPD.Name, out value.Value); this.Name = value; } ComTrace.WriteObject(deviceValues); }
/// <summary> /// Get supported formats /// </summary> /// <returns>List of supported formats</returns> public IEnumerable <Formats> GetSupportedFormats() { capabilities.GetSupportedFormats(out IPortableDevicePropVariantCollection formats); ComTrace.WriteObject(formats); return(formats.ToEnum <Formats>()); }
/// <summary> /// Get supported events /// </summary> /// <returns>list of supported events</returns> public IEnumerable <Events> GetSupportedEvents() { capabilities.GetSupportedEvents(out IPortableDevicePropVariantCollection events); ComTrace.WriteObject(events); return(events.ToEnum <Events>()); }
internal MediaDeviceService(MediaDevice device, string serviceId) { this.device = device; this.ServiceId = serviceId; //Match match = Regex.Match(serviceId, @".*#(?<service>\{.*\})\\(?<name>\{.*\})"); //if (match.Success) //{ // string service = match.Groups["service"].Value; // Guid serviceGuid = new Guid(service); // this.Service = serviceGuid.GetEnum<Services>(); // string serviceName = match.Groups["name"].Value; // this.ServiceName = $"{this.Service} : {service} : {serviceName}"; //} //else //{ // this.ServiceName = "Unknown"; //} //this.ServiceName = serviceId.Substring(serviceId.LastIndexOf(@"\") + 1); IPortableDeviceValues values = (IPortableDeviceValues) new PortableDeviceValues(); this.service.Open(this.ServiceId, values); this.service.GetServiceObjectID(out string serviceObjectID); this.ServiceObjectID = serviceObjectID; this.service.GetPnPServiceID(out string pnPServiceID); this.PnPServiceID = pnPServiceID; this.service.Capabilities(out capabilities); this.service.Content(out content); content.Properties(out IPortableDeviceProperties properties); properties.GetSupportedProperties(this.ServiceObjectID, out IPortableDeviceKeyCollection keyCol); properties.GetValues(this.ServiceObjectID, keyCol, out IPortableDeviceValues deviceValues); ComTrace.WriteObject(deviceValues); #pragma warning disable IDE0079 // Remove unnecessary suppression #pragma warning disable IDE0090 // Use 'new(...)' using (PropVariantFacade value = new PropVariantFacade()) { deviceValues.GetValue(ref WPD.OBJECT_NAME, out value.Value); this.Name = value; } using (PropVariantFacade value = new PropVariantFacade()) { deviceValues.GetValue(ref WPD.FUNCTIONAL_OBJECT_CATEGORY, out value.Value); Guid serviceGuid = new Guid((string)value); this.Service = serviceGuid.GetEnum <MediaDeviceServices>(); this.ServiceName = this.Service != MediaDeviceServices.Unknown ? this.Service.ToString() : serviceGuid.ToString(); } using (PropVariantFacade value = new PropVariantFacade()) { deviceValues.GetValue(ref WPD.SERVICE_VERSION, out value.Value); this.ServiceVersion = value; } #pragma warning restore IDE0090 // Use 'new(...)' #pragma warning restore IDE0079 // Remove unnecessary suppression Update(); //var x = GetContent().ToArray(); }
/// <summary> /// Get supported commands /// </summary> /// <returns>List of supported commands</returns> public IEnumerable <Commands> GetSupportedCommands() { capabilities.GetSupportedCommands(out IPortableDeviceKeyCollection commands); ComTrace.WriteObject(commands); return(commands.ToEnum <Commands>()); }
/// <summary> /// Get supported methods /// </summary> /// <returns>List of supported methods</returns> public IEnumerable <Methods> GetSupportedMethods() { capabilities.GetSupportedMethods(out IPortableDevicePropVariantCollection methods); ComTrace.WriteObject(methods); return(methods.ToEnum <Methods>()); }