private static IEnumerable <VersionNotes> GetVersionNotesFromNewsFeed(string xml) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xml); foreach (XmlNode patch in xmlDocument.DocumentElement["patches"].ChildNodes) { if (patch.Name == "patch") { var versionNotes = new VersionNotes(); if (patch.Attributes["version"] != null) { versionNotes.version = patch.Attributes["version"].Value; } else { continue; } if (patch["title"] != null) { versionNotes.title = $"[title]{patch["title"].InnerXml}"; } else { versionNotes.title = null; } if (patch.Attributes["silent"] != null) { versionNotes.silent = bool.Parse(patch.Attributes["silent"].Value); } else { versionNotes.silent = null; } if (patch["items"] != null) { var entries = new List <string>(); foreach (XmlNode item in patch["items"].ChildNodes) { entries.Add(item.InnerXml); } versionNotes.entries = entries.ToArray(); } yield return(versionNotes); } } }
private static VersionNotes Combine(VersionNotes orginal, VersionNotes target) { if (target.version != orginal.version) { throw new Exception("Bad news version"); } if (target.title != null) { orginal.title = target.title; } if (target.silent != null) { orginal.silent = target.silent; } if (target.entries != null) { orginal.entries = target.entries; } return(orginal); }