Ejemplo n.º 1
0
 static Changelog CreateChangelog(HtmlNode node) {
     var changelog = new Changelog();
     ChangelogVersion version = null;
     foreach (var child in node.ChildNodes) {
         HandleTitle(child, changelog);
         version = HandleChangelogVersionWithEntries(child, version, changelog);
         version = HandleOlderSection(child, version, changelog);
     }
     return changelog;
 }
Ejemplo n.º 2
0
        static ChangelogVersion CreateChangelogVersion(Changelog changelog, HtmlNode child) {
            string description = null;
            string title = null;
            string type = null;
            string version = null;
            DateTime dateTime;

            var data = Clean(child.InnerHtml);
            if (rxChangelogVersion.IsMatch(data)) {
                var match = rxChangelogVersion.Match(data);
                version = Version.Parse(match.Groups[1].Value).ToString();
                type = match.Groups[3].Value;
                dateTime = DateTime.Parse(match.Groups[5].Value);
            } else
                dateTime = DateTime.Parse(data);

            return new ChangelogVersion {
                Description = description,
                Title = title,
                Type = type,
                Changelog = changelog,
                Version = version,
                Released = dateTime
            };
        }
Ejemplo n.º 3
0
 static ChangelogVersion HandleChangelogVersion(HtmlNode child, Changelog changelog, ChangelogVersion version) {
     if (child.Name == "h3") {
         version = CreateChangelogVersion(changelog, child);
         changelog.Versions.Add(version);
     }
     return version;
 }
Ejemplo n.º 4
0
 static ChangelogVersion HandleChangelogVersionWithEntries(HtmlNode child, ChangelogVersion version,
     Changelog changelog) {
     version = HandleChangelogVersion(child, changelog, version);
     version = HandleChangelogEntries(child, version);
     return version;
 }
Ejemplo n.º 5
0
 static void HandleTitle(HtmlNode child, Changelog changelog) {
     if (child.Name == "h2")
         changelog.Title = child.InnerHtml;
 }
Ejemplo n.º 6
0
 static ChangelogVersion HandleOlderSection(HtmlNode child, ChangelogVersion version, Changelog changelog) {
     if (child.Name == "div" && child.Attributes["class"].Value.Contains("older")) {
         version = null;
         foreach (var n2 in child.ChildNodes)
             version = HandleChangelogVersionWithEntries(n2, version, changelog);
         version = null;
     }
     return version;
 }