diff --git a/AngelLoader/Common/DataClasses/LocalizationData.cs b/AngelLoader/Common/DataClasses/LocalizationData.cs index 79ee6cbc1..6eb54474d 100644 --- a/AngelLoader/Common/DataClasses/LocalizationData.cs +++ b/AngelLoader/Common/DataClasses/LocalizationData.cs @@ -29,6 +29,7 @@ internal sealed class LText_Class internal readonly AlertMessages_Class AlertMessages = new AlertMessages_Class(); internal readonly MainMenu_Class MainMenu = new MainMenu_Class(); internal readonly GameVersionsWindow_Class GameVersionsWindow = new GameVersionsWindow_Class(); + internal readonly GlobalFMStats_Class GlobalFMStats = new GlobalFMStats_Class(); internal readonly FMDeletion_Class FMDeletion = new FMDeletion_Class(); internal readonly Difficulties_Class Difficulties = new Difficulties_Class(); internal readonly FilterBar_Class FilterBar = new FilterBar_Class(); @@ -186,6 +187,7 @@ internal sealed class MainMenu_Class { internal readonly string MainMenuToolTip = "Main menu"; internal readonly string GameVersions = "Game versions..."; + internal readonly string GlobalFMStats = "Global FM stats..."; } internal sealed class GameVersionsWindow_Class @@ -217,6 +219,15 @@ internal sealed class GameVersionsWindow_Class internal readonly string Error_GameVersionNotFound = "Version not found"; } + internal sealed class GlobalFMStats_Class + { + internal readonly string TitleText = "Global FM stats"; + internal readonly string FMsInDatabase = "FMs in database:"; + internal readonly string AvailableFMs = "Available FMs:"; + internal readonly string Unscanned = "Unscanned:"; + internal readonly string Unsupported = "Invalid or unsupported:"; + } + internal sealed class FMDeletion_Class { internal readonly string ArchiveNotFound = "This FM's archive could not be found. To delete this FM permanently, simply uninstall it."; diff --git a/AngelLoader/Forms/CustomControls/Static_LazyLoaded/MainLLMenu.cs b/AngelLoader/Forms/CustomControls/Static_LazyLoaded/MainLLMenu.cs index a87e53788..f99594553 100644 --- a/AngelLoader/Forms/CustomControls/Static_LazyLoaded/MainLLMenu.cs +++ b/AngelLoader/Forms/CustomControls/Static_LazyLoaded/MainLLMenu.cs @@ -10,7 +10,7 @@ internal static class MainLLMenu internal static ContextMenuStrip Menu = null!; private static ToolStripMenuItem GameVersionsMenuItem = null!; - private static ToolStripMenuItem FMsListStatsMenuItem = null!; + private static ToolStripMenuItem GlobalFMStatsMenuItem = null!; internal static void Construct(MainForm form, IContainer components) { @@ -20,11 +20,11 @@ internal static void Construct(MainForm form, IContainer components) Menu.Items.AddRange(new ToolStripItem[] { GameVersionsMenuItem = new ToolStripMenuItem(), - FMsListStatsMenuItem = new ToolStripMenuItem() + GlobalFMStatsMenuItem = new ToolStripMenuItem() }); GameVersionsMenuItem.Click += form.MainMenu_GameVersionsMenuItem_Click; - FMsListStatsMenuItem.Click += form.FMsListStatsMenuItem_Click; + GlobalFMStatsMenuItem.Click += form.GlobalFMStatsMenuItem_Click; _constructed = true; @@ -36,6 +36,7 @@ internal static void Localize() if (!_constructed) return; GameVersionsMenuItem.Text = LText.MainMenu.GameVersions; + GlobalFMStatsMenuItem.Text = LText.MainMenu.GlobalFMStats; } } } diff --git a/AngelLoader/Forms/FMsListStatsForm.Designer.cs b/AngelLoader/Forms/GlobalFMStatsForm.Designer.cs similarity index 97% rename from AngelLoader/Forms/FMsListStatsForm.Designer.cs rename to AngelLoader/Forms/GlobalFMStatsForm.Designer.cs index f33e484b2..d9b54b754 100644 --- a/AngelLoader/Forms/FMsListStatsForm.Designer.cs +++ b/AngelLoader/Forms/GlobalFMStatsForm.Designer.cs @@ -1,6 +1,6 @@ namespace AngelLoader.Forms { - sealed partial class FMsListStatsForm + sealed partial class GlobalFMStatsForm { /// /// Required designer variable. @@ -52,6 +52,7 @@ private void InitializeComponent() this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OKButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.OKButton.Location = new System.Drawing.Point(712, 416); + this.OKButton.MinimumSize = new System.Drawing.Size(75, 23); this.OKButton.Name = "OKButton"; this.OKButton.Size = new System.Drawing.Size(75, 23); this.OKButton.TabIndex = 0; @@ -194,7 +195,7 @@ private void InitializeComponent() this.FMsInDatabaseTextBox.Size = new System.Drawing.Size(100, 20); this.FMsInDatabaseTextBox.TabIndex = 2; // - // FMsListStatsForm + // GlobalFMStatsForm // this.AcceptButton = this.OKButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -221,9 +222,10 @@ private void InitializeComponent() this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "FMsListStatsForm"; + this.Name = "GlobalFMStatsForm"; + this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "FMs list stats"; + this.Text = "Global FM stats"; this.ResumeLayout(false); this.PerformLayout(); diff --git a/AngelLoader/Forms/FMsListStatsForm.cs b/AngelLoader/Forms/GlobalFMStatsForm.cs similarity index 71% rename from AngelLoader/Forms/FMsListStatsForm.cs rename to AngelLoader/Forms/GlobalFMStatsForm.cs index f06c1c040..dd902b178 100644 --- a/AngelLoader/Forms/FMsListStatsForm.cs +++ b/AngelLoader/Forms/GlobalFMStatsForm.cs @@ -13,12 +13,31 @@ namespace AngelLoader.Forms { - public sealed partial class FMsListStatsForm : Form + public sealed partial class GlobalFMStatsForm : Form { - public FMsListStatsForm() + public GlobalFMStatsForm() { InitializeComponent(); + CalculateStats(); + + Localize(); + } + + private void Localize() + { + Text = LText.GlobalFMStats.TitleText; + + FMsInDatabaseLabel.Text = LText.GlobalFMStats.FMsInDatabase; + AvailableFMsLabel.Text = LText.GlobalFMStats.AvailableFMs; + T1Label.Text = LText.Global.Thief1_Colon; + T2Label.Text = LText.Global.Thief2_Colon; + T3Label.Text = LText.Global.Thief3_Colon; + SS2Label.Text = LText.Global.SystemShock2_Colon; + UnscannedLabel.Text = LText.GlobalFMStats.Unscanned; + UnsupportedLabel.Text = LText.GlobalFMStats.Unsupported; + + OKButton.Text = LText.Global.OK; } private void CalculateStats() diff --git a/AngelLoader/Forms/FMsListStatsForm.resx b/AngelLoader/Forms/GlobalFMStatsForm.resx similarity index 100% rename from AngelLoader/Forms/FMsListStatsForm.resx rename to AngelLoader/Forms/GlobalFMStatsForm.resx diff --git a/AngelLoader/Forms/MainForm.cs b/AngelLoader/Forms/MainForm.cs index 53f4a66f0..3b7da5a13 100644 --- a/AngelLoader/Forms/MainForm.cs +++ b/AngelLoader/Forms/MainForm.cs @@ -1534,9 +1534,9 @@ internal void MainMenu_GameVersionsMenuItem_Click(object sender, EventArgs e) } [SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Global")] - internal void FMsListStatsMenuItem_Click(object sender, EventArgs e) + internal void GlobalFMStatsMenuItem_Click(object sender, EventArgs e) { - using var f = new FMsListStatsForm(); + using var f = new GlobalFMStatsForm(); f.ShowDialog(); } diff --git a/AngelLoader/Ini/LocalizationIni.Generated.cs b/AngelLoader/Ini/LocalizationIni.Generated.cs index deb3f8c4f..ddc130bab 100644 --- a/AngelLoader/Ini/LocalizationIni.Generated.cs +++ b/AngelLoader/Ini/LocalizationIni.Generated.cs @@ -73,6 +73,12 @@ internal static LText_Class ReadLocalizationIni(string file) { GameVersionsWindow_Dict.Add(f.Name, f); } + var globalFMStatsFields = typeof(LText_Class.GlobalFMStats_Class).GetFields(_bfLText); + var GlobalFMStats_Dict = new Dictionary(globalFMStatsFields.Length); + foreach (var f in globalFMStatsFields) + { + GlobalFMStats_Dict.Add(f.Name, f); + } var fMDeletionFields = typeof(LText_Class.FMDeletion_Class).GetFields(_bfLText); var FMDeletion_Dict = new Dictionary(fMDeletionFields.Length); foreach (var f in fMDeletionFields) @@ -328,6 +334,28 @@ internal static LText_Class ReadLocalizationIni(string file) i++; } } + else if (lineT == "[GlobalFMStats]") + { + while (i < linesLength - 1) + { + int ltLength; + string lt = lines[i + 1].TrimStart(); + int eqIndex = lt.IndexOf('='); + if (eqIndex > -1) + { + string key = lt.Substring(0, eqIndex); + if (GlobalFMStats_Dict.TryGetValue(key, out FieldInfo value)) + { + value.SetValue(ret.GlobalFMStats, lt.Substring(eqIndex + 1)); + } + } + else if ((ltLength = lt.Length) > 0 && lt[0] == '[' && lt[ltLength - 1] == ']') + { + break; + } + i++; + } + } else if (lineT == "[FMDeletion]") { while (i < linesLength - 1) diff --git a/AngelLoader/Languages/English.ini b/AngelLoader/Languages/English.ini index 6692e6dd4..07c4f424d 100644 --- a/AngelLoader/Languages/English.ini +++ b/AngelLoader/Languages/English.ini @@ -122,6 +122,7 @@ Help_UnableToOpenHelpFile=Unable to open help file. [MainMenu] MainMenuToolTip=Main menu GameVersions=Game versions... +GlobalFMStats=Global FM stats... [GameVersionsWindow] ; This is where game versions are displayed. @@ -145,6 +146,13 @@ Error_SneakyDllNotFound=Sneaky.dll not found ; A version could not be found inside the .exe/.dll file. Error_GameVersionNotFound=Version not found +[GlobalFMStats] +TitleText=Global FM stats +FMsInDatabase=FMs in database: +AvailableFMs=Available FMs: +Unscanned=Unscanned: +Unsupported=Invalid or unsupported: + [FMDeletion] ArchiveNotFound=This FM's archive could not be found. To delete this FM permanently, simply uninstall it. AboutToDelete=The following FM archive is about to be deleted from disk: