/// <summary> /// Populates the object with specified XML. /// </summary> /// <param name="xml">The XML used to populate the object..</param> public void Populate(string xml) { this.Fanart.Clear(); this.Poster.Clear(); this.Season.Clear(); this.Series.Clear(); var docMain = new XmlDocument(); docMain.LoadXml(xml); var nodes = docMain.GetElementsByTagName("Banner"); foreach (XmlNode node in nodes) { var doc = new XmlDocument(); doc.LoadXml(node.OuterXml); var bannerDetails = new BannerDetails { ID = XRead.GetUInt(doc, "id"), BannerPath = XRead.GetString(doc, "BannerPath"), Colors = XRead.GetString(doc, "Colors"), Language = XRead.GetString(doc, "Language"), SeriesName = XRead.GetString(doc, "SeriesName"), ThumbnailPath = XRead.GetString(doc, "ThumbnailPath"), VignettePath = XRead.GetString(doc, "VignettePath"), Season = XRead.GetString(doc, "Season") }; switch (XRead.GetString(doc, "BannerType2")) { case "1920x1080": bannerDetails.BannerType2 = BannerType2.r1920x1080; break; case "1280x720": bannerDetails.BannerType2 = BannerType2.r1280x720; break; case "600x1000": bannerDetails.BannerType2 = BannerType2.r680x1000; break; case "season": bannerDetails.BannerType2 = BannerType2.season; break; case "seasonwide": bannerDetails.BannerType2 = BannerType2.seasonwide; break; case "graphical": bannerDetails.BannerType2 = BannerType2.graphical; break; case "text": bannerDetails.BannerType2 = BannerType2.text; break; case "blank": bannerDetails.BannerType2 = BannerType2.blank; break; } switch (XRead.GetString(doc, "BannerType")) { case "fanart": bannerDetails.BannerType = BannerType.Fanart; this.Fanart.Add(bannerDetails); break; case "poster": bannerDetails.BannerType = BannerType.Poster; this.Poster.Add(bannerDetails); break; case "season": bannerDetails.BannerType = BannerType.Season; this.Season.Add(bannerDetails); break; case "series": bannerDetails.BannerType = BannerType.Series; this.Series.Add(bannerDetails); break; } } }
/// <summary> /// Populates the object with specified XML. /// </summary> /// <param name="xml">The XML used to populate the object..</param> public void Populate(string xml) { this.Fanart.Clear(); this.Poster.Clear(); this.Season.Clear(); this.Series.Clear(); var docMain = new XmlDocument(); docMain.LoadXml(xml); var nodes = docMain.GetElementsByTagName("Banner"); foreach (XmlNode node in nodes) { var doc = new XmlDocument(); doc.LoadXml(node.OuterXml); var bannerDetails = new BannerDetails { ID = XRead.GetUInt(doc, "id"), BannerPath = XRead.GetString(doc, "BannerPath"), Colors = XRead.GetString(doc, "Colors"), Language = XRead.GetString(doc, "Language"), SeriesName = XRead.GetString(doc, "SeriesName"), ThumbnailPath = XRead.GetString(doc, "ThumbnailPath"), VignettePath = XRead.GetString(doc, "VignettePath"), Season = XRead.GetString(doc, "Season") }; switch (XRead.GetString(doc, "BannerType2")) { case "1920x1080": bannerDetails.BannerType2 = BannerType2.r1920x1080; break; case "1280x720": bannerDetails.BannerType2 = BannerType2.r1280x720; break; case "600x1000": bannerDetails.BannerType2 = BannerType2.r680x1000; break; case "season": bannerDetails.BannerType2 = BannerType2.season; break; case "seasonwide": bannerDetails.BannerType2 = BannerType2.seasonwide; break; case "graphical": bannerDetails.BannerType2 = BannerType2.graphical; break; case "text": bannerDetails.BannerType2 = BannerType2.text; break; case "blank": bannerDetails.BannerType2 = BannerType2.blank; break; } switch (XRead.GetString(doc, "BannerType")) { case "fanart": bannerDetails.BannerType = BannerType.Fanart; this.Fanart.Add(bannerDetails); break; case "poster": bannerDetails.BannerType = BannerType.Poster; this.Poster.Add(bannerDetails); break; case "season": bannerDetails.BannerType = BannerType.Season; this.Season.Add(bannerDetails); break; case "series": bannerDetails.BannerType = BannerType.Series; this.Series.Add(bannerDetails); break; } } }