示例#1
0
        public void ReadXml(XmlReader reader)
        {
            if (reader.LocalName != "service" && !reader.ReadToDescendant("service"))
            {
                throw new InvalidDataException();
            }

            var dict = new Dictionary <string, Action>()
            {
                { "serviceType", () => this.Type = UpnpType.Parse(reader.ReadString()) },
                { "serviceId", () => this.Id = reader.ReadString() },
                { "SCPDURL", () => this.RelativeScpdUrl = reader.ReadString() },
                { "controlURL", () => this.RelativeControlUrl = reader.ReadString() },
                { "eventSubURL", () => this.RelativeEventUrl = reader.ReadString() }
            };

            XmlHelper.ParseXml(reader, dict);
        }
示例#2
0
        public IEnumerable <UpnpDevice> FindByDeviceType(UpnpType type)
        {
            var root = this.RootDevice;

            if (root == null)
            {
                yield break;
            }

            if (root.Type.Equals(type))
            {
                yield return(root);
            }

            foreach (var device in root.FindByDeviceType(type))
            {
                yield return(device);
            }
        }
示例#3
0
 public IEnumerable <UpnpDevice> FindByDeviceType(UpnpType type)
 {
     return(this.EnumerateDevices().Where(d => d.Type.Equals(type)));
 }
示例#4
0
 public static IEnumerable <UpnpService> FindByServiceType(this UpnpDevice device, UpnpType type)
 {
     return(device.EnumerateServices().Where(service => service.Type.Equals(type)));
 }
示例#5
0
 public static IEnumerable <UpnpService> FindByServiceType(this UpnpRoot root, UpnpType type)
 {
     return(root.RootDevice.FindByServiceType(type));
 }
示例#6
0
 public static IEnumerable <UpnpDevice> FindByDeviceType(this UpnpRoot @this, UpnpType type)
 {
     return(@this.RootDevice.FindByDeviceType(type));
 }