Automate announcement id

This commit is contained in:
D1GQ committed 2026-01-09 22:32:38 -06:00
1 parent 86c7266f71
commit e3b13e5b59
8 files changed
+8 -20

No files matched your search

-1
View File
@@ -1,6 +1,5 @@
^show: true
^type: 1
^id: 110003
^title: Hotfix Patch Notes
^subtitle: Just a quick hotfix!
^listtitle: BAU v1.3.0 H1
-1
View File
@@ -1,6 +1,5 @@
^show: true
^type: 1
^id: 110004
^title: Hotfix Patch Notes
^subtitle: Just a quick hotfix!
^listtitle: BAU v1.3.0 H2
-1
View File
@@ -1,6 +1,5 @@
^show: true
^type: 1
^id: 110005
^title: Hotfix Patch Notes
^subtitle: Just a quick hotfix!
^listtitle: BAU v1.3.0 H3
-1
View File
@@ -1,6 +1,5 @@
^show: true
^type: 1
^id: 110002
^title: Long time no see :)
^subtitle: We are back!
^listtitle: BAU v1.3.0
-1
View File
@@ -1,6 +1,5 @@
^show: false
^type: 1
^id: 110001
^title: Main Header
^subtitle: Main Header SubText
^listtitle: List Name
+8 -7
View File
@@ -17,8 +17,8 @@ internal sealed class ModNews
public Dictionary<int, string> Contents { get; set; } = [];
internal string Date { get; }
internal static List<NewsData> NewsDataToProcess { get; } = new();
internal static List<ModNews> AllModNews { get; } = new();
internal static List<NewsData> NewsDataToProcess { get; } = [];
internal static List<ModNews> AllModNews { get; } = [];
internal ModNews(NewsTypes type, int number, string title, string subTitle, string shortTitle, Dictionary<int, string> contents, string date)
{
@@ -59,21 +59,22 @@ internal sealed class ModNews
return announcement;
}
private static int _nextAnnouncementNumber;
internal static void ProcessModNewsFiles()
{
AllModNews.Clear();
_nextAnnouncementNumber = 110000;
foreach (var config in NewsDataToProcess)
{
ParseModNewsContent(config);
ParseModNewsContent(config, _nextAnnouncementNumber);
_nextAnnouncementNumber++;
}
}
private static void ParseModNewsContent(NewsData config)
private static void ParseModNewsContent(NewsData config, int nextAnnouncementNumber)
{
if (config.Id == 0) return;
var type = (NewsTypes)config.Type;
_ = new ModNews(type, (int)config.Id, config.Title, config.SubTitle, config.ListTitle, config.Contents, config.Date);
_ = new ModNews(type, nextAnnouncementNumber, config.Title, config.SubTitle, config.ListTitle, config.Contents, config.Date);
}
}
-7
View File
@@ -19,11 +19,6 @@ internal sealed class NewsData()
/// </summary>
public int Type { get; set; }
/// <summary>
/// Unique identifier for the news item.
/// </summary>
public uint Id { get; set; }
/// <summary>
/// The main title of the news item.
/// </summary>
@@ -61,8 +56,6 @@ internal sealed class NewsData()
newsData.Show = bool.Parse(show);
if (data.TryGetValue("type", out var type))
newsData.Type = int.Parse(type);
if (data.TryGetValue("id", out var id))
newsData.Id = uint.Parse(id);
if (data.TryGetValue("title", out var title))
newsData.Title = title;
if (data.TryGetValue("subtitle", out var subtitle))
-1
View File
@@ -1,6 +1,5 @@
^show: false
^type: 1
^id: 110000
^title: Header
^subtitle: Text Under Header
^listtitle: List Name