} // ParseArgument() /// <summary> /// Parses the device schema. /// </summary> /// <param name="xdevice">The parent element.</param> /// <returns>A <see cref="DeviceSchema"/> object.</returns> private static DeviceSchema ParseDeviceSchema(XContainer xdevice) { var schema = new DeviceSchema(); schema.DeviceType = XmlSupport.GetFirstSubNodeValue(xdevice, "deviceType"); schema.FriendlyName = XmlSupport.GetFirstSubNodeValue(xdevice, "friendlyName"); schema.Manufacturer = XmlSupport.GetFirstSubNodeValue(xdevice, "manufacturer"); schema.ManufacturerUrl = XmlSupport.GetFirstSubNodeValue(xdevice, "manufacturerURL", false); schema.ModelDescription = XmlSupport.GetFirstSubNodeValue(xdevice, "modelDescription", false); schema.ModelName = XmlSupport.GetFirstSubNodeValue(xdevice, "modelName"); schema.ModelNumber = XmlSupport.GetFirstSubNodeValue(xdevice, "modelNumber", false); schema.ModelUrl = XmlSupport.GetFirstSubNodeValue(xdevice, "modelURL", false); schema.SerialNumber = XmlSupport.GetFirstSubNodeValue(xdevice, "serialNumber", false); schema.UDN = XmlSupport.GetFirstSubNodeValue(xdevice, "UDN"); var xiconList = XmlSupport.GetFirstSubNode(xdevice, "iconList", false); if (xiconList != null) { var iconList = from xicon in xiconList.Elements() where (xicon.Name.LocalName == "icon") select xicon; foreach (var xicon in iconList) { var icon = new DeviceIcon(); icon.MimeType = XmlSupport.GetFirstSubNodeValue(xicon, "mimetype"); icon.Width = int.Parse(XmlSupport.GetFirstSubNodeValue(xicon, "width")); icon.Height = int.Parse(XmlSupport.GetFirstSubNodeValue(xicon, "height")); icon.Depth = int.Parse(XmlSupport.GetFirstSubNodeValue(xicon, "depth")); icon.URL = XmlSupport.GetFirstSubNodeValue(xicon, "url"); schema.AddIcon(icon); } // foreach } // if var xserviceList = XmlSupport.GetFirstSubNode(xdevice, "serviceList"); var serviceList = from xservice in xserviceList.Elements() where (xservice.Name.LocalName == "service") select xservice; foreach (var xservice in serviceList) { var service = new UpnpService(); service.Type = XmlSupport.GetFirstSubNodeValue(xservice, "serviceType"); service.Id = XmlSupport.GetFirstSubNodeValue(xservice, "serviceId"); service.ControlUrl = XmlSupport.GetFirstSubNodeValue(xservice, "controlURL"); service.EventSubURL = XmlSupport.GetFirstSubNodeValue(xservice, "eventSubURL"); service.ScpdUrl = XmlSupport.GetFirstSubNodeValue(xservice, "SCPDURL"); schema.AddService(service); } // foreach var xdeviceList = XmlSupport.GetFirstSubNode(xdevice, "deviceList", false); if (xdeviceList != null) { var deviceList = from xsubDevice in xdeviceList.Elements() where (xsubDevice.Name.LocalName == "device") select xsubDevice; foreach (var xsubDevice in deviceList) { var device = ParseDeviceSchema(xsubDevice); schema.AddSubDevice(device); } // foreach } // if schema.PresentationUrl = XmlSupport.GetFirstSubNodeValue(xdevice, "presentationURL", false); return(schema); } // ParseDeviceSchema()
} // DeviceSchema() #endregion // CONSTRUCTION //// --------------------------------------------------------------------- #region PUBLIC METHODS /// <summary> /// Adds the icon. /// </summary> /// <param name="icon">The icon.</param> public void AddIcon(DeviceIcon icon) { this.icons.Add(icon); } // AddIcon()