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); }
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); } }
public IEnumerable <UpnpDevice> FindByDeviceType(UpnpType type) { return(this.EnumerateDevices().Where(d => d.Type.Equals(type))); }
public static IEnumerable <UpnpService> FindByServiceType(this UpnpDevice device, UpnpType type) { return(device.EnumerateServices().Where(service => service.Type.Equals(type))); }
public static IEnumerable <UpnpService> FindByServiceType(this UpnpRoot root, UpnpType type) { return(root.RootDevice.FindByServiceType(type)); }
public static IEnumerable <UpnpDevice> FindByDeviceType(this UpnpRoot @this, UpnpType type) { return(@this.RootDevice.FindByDeviceType(type)); }