예제 #1
0
파일: UpnpService.cs 프로젝트: sjndhkl/Upnp
        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));
 }