X-Git-Url: https://fortfriendship.online/gitweb/gnargle.github.io.git/blobdiff_plain/1e7c451125f0358ffb8b6ab0d253493bbe856d29..0f7866c338a2cbab0d34dd02bc62838b5eb5d54f:/RSSGen/Program.cs?ds=inline diff --git a/RSSGen/Program.cs b/RSSGen/Program.cs deleted file mode 100644 index 1af488a..0000000 --- a/RSSGen/Program.cs +++ /dev/null @@ -1,76 +0,0 @@ -using RssFeedGenerator; -using System; -using System.Collections.Generic; -using System.IO; - -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Scanning entries folder for latest files"); - -var filePaths = Directory.EnumerateFiles(Path.Combine(Directory.GetCurrentDirectory(), "../../../../entries")); -var fileInfos = new List(); - -if (filePaths.Any()) -{ - foreach (var path in filePaths) - { - if (Path.GetFileNameWithoutExtension(path).Equals("template", StringComparison.InvariantCultureIgnoreCase)) - continue; - var fInfo = new FileInfo(path); - fileInfos.Add(fInfo); - } -} - -Console.WriteLine("Scanning projects folder for latest files"); - -filePaths = Directory.EnumerateFiles(Path.Combine(Directory.GetCurrentDirectory(), "../../../../projects")); - -if (filePaths.Any()) -{ - foreach (var path in filePaths) - { - var fInfo = new FileInfo(path); - fileInfos.Add(fInfo); - } -} - -fileInfos = fileInfos.OrderByDescending(f => f.CreationTimeUtc).Take(10).ToList(); - -var myRSS = new rss(); - -myRSS.version = 2.0m; - -myRSS.channel = new rssChannel -{ - title = "athene.gay entries", - description = "blog entries for athene.gay", - language = "en-GB", - link = "https://athene.gay", - item = new List() -}; - -foreach (var file in fileInfos) -{ - var item = new rssChannelItem() - { - title = Path.GetFileNameWithoutExtension(file.Name), - pubDate = file.CreationTimeUtc.ToString(), - }; - if (file.FullName.Contains("entries")) - { - item.link = "https://athene.gay/entries/" + Path.GetFileName(file.Name); - } else if (file.FullName.Contains("projects")) - { - item.link = "https://athene.gay/projects/" + Path.GetFileName(file.Name); - } - myRSS.channel.item.Add(item); -} - -var output = Generator.SerializeRSS(myRSS); - -var rssPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../../feed.rss"); - -if (File.Exists(rssPath)) { - File.Delete(rssPath); -} - -File.WriteAllText(rssPath, output); \ No newline at end of file