]> fortfriendship.online Git - gnargle.github.io.git/commitdiff
fixed
authorAthene Allen <atheneallen93@gmail.com>
Thu, 30 Jan 2025 13:38:43 +0000 (13:38 +0000)
committerAthene Allen <atheneallen93@gmail.com>
Thu, 30 Jan 2025 13:38:43 +0000 (13:38 +0000)
.gitignore
RSSGen/Program.cs [new file with mode: 0644]
RSSGen/RSSGen.csproj [new file with mode: 0644]
RSSGen/RSSGen.sln [new file with mode: 0644]

index b621bfc1a9e914b2f45844dcc7f859253b89a6cf..d6ab001f93d73bb1091befaf94a2fff621168a32 100644 (file)
@@ -20,20 +20,5 @@ Gemfile.lock
 RSSGen/.vs/ProjectEvaluation/rssgen.metadata.v9.bin
 RSSGen/.vs/ProjectEvaluation/rssgen.projects.v9.bin
 RSSGen/.vs/ProjectEvaluation/rssgen.strings.v9.bin
-RSSGen/bin/Debug/net8.0/RSSGen.dll
-RSSGen/bin/Debug/net8.0/RSSGen.exe
-RSSGen/bin/Debug/net8.0/RSSGen.pdb
-RSSGen/obj/project.nuget.cache
-RSSGen/obj/RSSGen.csproj.nuget.dgspec.json
-RSSGen/obj/RSSGen.csproj.nuget.g.props
-RSSGen/obj/Debug/net8.0/apphost.exe
-RSSGen/obj/Debug/net8.0/RSSGen.AssemblyInfo.cs
-RSSGen/obj/Debug/net8.0/RSSGen.AssemblyInfoInputs.cache
-RSSGen/obj/Debug/net8.0/RSSGen.assets.cache
-RSSGen/obj/Debug/net8.0/RSSGen.dll
-RSSGen/obj/Debug/net8.0/RSSGen.GeneratedMSBuildEditorConfig.editorconfig
-RSSGen/obj/Debug/net8.0/RSSGen.genruntimeconfig.cache
-RSSGen/obj/Debug/net8.0/RSSGen.pdb
-RSSGen/obj/Debug/net8.0/RSSGen.sourcelink.json
-RSSGen/obj/Debug/net8.0/ref/RSSGen.dll
-RSSGen/obj/Debug/net8.0/refint/RSSGen.dll
+RSSGen/bin/
+RSSGen/obj/
diff --git a/RSSGen/Program.cs b/RSSGen/Program.cs
new file mode 100644 (file)
index 0000000..1af488a
--- /dev/null
@@ -0,0 +1,76 @@
+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<FileInfo>();
+
+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<rssChannelItem>()
+};
+
+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
diff --git a/RSSGen/RSSGen.csproj b/RSSGen/RSSGen.csproj
new file mode 100644 (file)
index 0000000..278f221
--- /dev/null
@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="RssFeedGenerator" Version="1.2.1" />
+  </ItemGroup>
+
+</Project>
diff --git a/RSSGen/RSSGen.sln b/RSSGen/RSSGen.sln
new file mode 100644 (file)
index 0000000..a16b414
--- /dev/null
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.12.35707.178 d17.12
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RSSGen", "RSSGen.csproj", "{5B1B1ED0-6FEF-45A8-A5F1-60EB2EFE5B8A}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Any CPU = Debug|Any CPU
+               Release|Any CPU = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {5B1B1ED0-6FEF-45A8-A5F1-60EB2EFE5B8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {5B1B1ED0-6FEF-45A8-A5F1-60EB2EFE5B8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {5B1B1ED0-6FEF-45A8-A5F1-60EB2EFE5B8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {5B1B1ED0-6FEF-45A8-A5F1-60EB2EFE5B8A}.Release|Any CPU.Build.0 = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal