예제 #1
0
        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);
        }
예제 #2
0
        /// <summary>
        /// Update service
        /// </summary>
        protected override void Update()
        {
            IPortableDeviceKeyCollection keyCol = (IPortableDeviceKeyCollection) new PortableDeviceKeyCollection();

            keyCol.Add(ref WPD.SignalStrength);
            keyCol.Add(ref WPD.TextMessages);
            keyCol.Add(ref WPD.NewPictures);
            keyCol.Add(ref WPD.MissedCalls);
            keyCol.Add(ref WPD.VoiceMail);
            keyCol.Add(ref WPD.NetworkName);
            keyCol.Add(ref WPD.NetworkType);
            keyCol.Add(ref WPD.Roaming);
            keyCol.Add(ref WPD.BatteryLife);
            keyCol.Add(ref WPD.ChargingState);
            keyCol.Add(ref WPD.StorageCapacity);
            keyCol.Add(ref WPD.StorageFreeSpace);
            keyCol.Add(ref WPD.InternetConnected);
            IPortableDeviceValues values = GetProperties(keyCol);

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.SignalStrength, out value.Value);
                this.SignalStrength = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.TextMessages, out value.Value);
                this.TextMessages = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.NewPictures, out value.Value);
                this.NewPictures = value;
            }


            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.MissedCalls, out value.Value);
                this.MissedCalls = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.VoiceMail, out value.Value);
                this.VoiceMail = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.NetworkName, out value.Value);
                this.NetworkName = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.NetworkType, out value.Value);
                this.NetworkType = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.Roaming, out value.Value);
                this.Roaming = (Roaming)(byte)value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.BatteryLife, out value.Value);
                this.BatteryLife = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.ChargingState, out value.Value);
                this.ChargingState = (ChargingState)(byte)value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.StorageCapacity, out value.Value);
                this.StorageCapacity = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.StorageFreeSpace, out value.Value);
                this.StorageFreeSpace = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.InternetConnected, out value.Value);
                this.InternetConnected = value;
            }
        }
예제 #3
0
        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();
        }
예제 #4
0
        /// <summary>
        /// Update service
        /// </summary>
        protected override void Update()
        {
            IPortableDeviceKeyCollection keyCol = (IPortableDeviceKeyCollection) new PortableDeviceKeyCollection();

            keyCol.Add(ref WPD.ParentId);
            keyCol.Add(ref WPD.Name);
            keyCol.Add(ref WPD.PUOID);
            keyCol.Add(ref WPD.ObjectFormat);
            keyCol.Add(ref WPD.ObjectSize);
            keyCol.Add(ref WPD.StorageID);
            keyCol.Add(ref WPD.LanguageLocale);
            keyCol.Add(ref WPD.ContentID);
            keyCol.Add(ref WPD.DefaultCAB);

            IPortableDeviceValues values = GetProperties(keyCol);

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.ParentId, out value.Value);
                this.ParentId = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.Name, out value.Value);
                this.Name = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.PUOID, out value.Value);
                this.PUOID = value;
            }


            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.ObjectFormat, out value.Value);
                this.ObjectFormat = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.ObjectSize, out value.Value);
                this.ObjectSize = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.StorageID, out value.Value);
                this.StorageID = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.LanguageLocale, out value.Value);
                this.LanguageLocale = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.ContentID, out value.Value);
                this.ContentID = value;
            }

            using (PropVariantFacade value = new PropVariantFacade())
            {
                values.GetValue(ref WPD.DefaultCAB, out value.Value);
                this.DefaultCAB = value;
            }
        }