public static List <DLNAService> CreateDLNAServiceList(string Content) { List <DLNAService> result = new List <DLNAService>(); try { if (!string.IsNullOrEmpty(Content)) { string servicelist = GetXMLContent(Content, "serviceList"); string[] sep = { "</service>" }; string[] sl = servicelist.Split(sep, StringSplitOptions.RemoveEmptyEntries); foreach (string service in sl) { DLNAService ds = CreateDLNAService(service); if (ds != null) { result.Add(ds); } } } } catch (Exception) { result = null; } return(result); }
public static DLNAService CreateDLNAService(string Content) { DLNAService result = null; try { if (!string.IsNullOrEmpty(Content)) { string servicetype = GetXMLContent(Content, "serviceType"); string serviceid = GetXMLContent(Content, "serviceId"); string controlurl = GetXMLContent(Content, "controlURL"); string scpdurl = GetXMLContent(Content, "SCPDURL"); string eventsuburl = GetXMLContent(Content, "eventSubURL"); result = new DLNAService(controlurl, scpdurl, eventsuburl, servicetype, serviceid); } } catch (Exception) { result = null; } return(result); }