diff --git a/AngelLoader/Common/Paths.cs b/AngelLoader/Common/Paths.cs index dd8d7ee56..cb39e0189 100644 --- a/AngelLoader/Common/Paths.cs +++ b/AngelLoader/Common/Paths.cs @@ -162,6 +162,9 @@ internal static void CreateOrClearTempPath(string path) internal const string NewDarkLoaderIni = "NewDarkLoader.ini"; internal const string FMSelIni = "fmsel.ini"; + // A dir that goes in the installed FMs dir and isn't an FM, so we have to ignore it when finding FMs + internal const string FMSelCache = ".fmsel.cache"; + #endregion #region FM backup diff --git a/AngelLoader/FindFMs.cs b/AngelLoader/FindFMs.cs index 37528127c..2dd620d54 100644 --- a/AngelLoader/FindFMs.cs +++ b/AngelLoader/FindFMs.cs @@ -109,7 +109,7 @@ internal static List Find(bool startup = false) for (int di = 0; di < dirs.Count; di++) { string d = dirs[di]; - if (!d.EqualsI(".fmsel.cache")) + if (!d.EqualsI(Paths.FMSelCache)) { perGameInstFMDirsList[gi].Add(d); perGameInstFMDirsDatesList[gi].Add(dateTimes[di]); diff --git a/AngelLoader/Forms/FMsListStatsForm.Designer.cs b/AngelLoader/Forms/FMsListStatsForm.Designer.cs index 1be5587ef..f33e484b2 100644 --- a/AngelLoader/Forms/FMsListStatsForm.Designer.cs +++ b/AngelLoader/Forms/FMsListStatsForm.Designer.cs @@ -1,6 +1,6 @@ namespace AngelLoader.Forms { - partial class FMsListStatsForm + sealed partial class FMsListStatsForm { /// /// Required designer variable. @@ -29,17 +29,27 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.OKButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); + this.AvailableFMsLabel = new System.Windows.Forms.Label(); + this.T1Label = new System.Windows.Forms.Label(); + this.T2Label = new System.Windows.Forms.Label(); + this.T3Label = new System.Windows.Forms.Label(); + this.SS2Label = new System.Windows.Forms.Label(); + this.UnscannedLabel = new System.Windows.Forms.Label(); + this.UnsupportedLabel = new System.Windows.Forms.Label(); + this.AvailableFMsTextBox = new System.Windows.Forms.TextBox(); + this.T1TextBox = new System.Windows.Forms.TextBox(); + this.T2TextBox = new System.Windows.Forms.TextBox(); + this.T3TextBox = new System.Windows.Forms.TextBox(); + this.SS2TextBox = new System.Windows.Forms.TextBox(); + this.UnscannedTextBox = new System.Windows.Forms.TextBox(); + this.UnsupportedTextBox = new System.Windows.Forms.TextBox(); + this.FMsInDatabaseLabel = new System.Windows.Forms.Label(); + this.FMsInDatabaseTextBox = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // OKButton // + 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.Name = "OKButton"; @@ -48,68 +58,141 @@ private void InitializeComponent() this.OKButton.Text = "OK"; this.OKButton.UseVisualStyleBackColor = true; // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(64, 56); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(76, 13); - this.label1.TabIndex = 1; - this.label1.Text = "Available FMs:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(64, 80); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(43, 13); - this.label2.TabIndex = 1; - this.label2.Text = "Thief 1:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(64, 104); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(43, 13); - this.label3.TabIndex = 1; - this.label3.Text = "Thief 2:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(64, 128); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(43, 13); - this.label4.TabIndex = 1; - this.label4.Text = "Thief 3:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(64, 152); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 13); - this.label5.TabIndex = 1; - this.label5.Text = "System Shock 2:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(64, 176); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(65, 13); - this.label6.TabIndex = 1; - this.label6.Text = "Unscanned:"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(64, 200); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(115, 13); - this.label7.TabIndex = 1; - this.label7.Text = "Invalid or unsupported:"; + // AvailableFMsLabel + // + this.AvailableFMsLabel.AutoSize = true; + this.AvailableFMsLabel.Location = new System.Drawing.Point(64, 75); + this.AvailableFMsLabel.Name = "AvailableFMsLabel"; + this.AvailableFMsLabel.Size = new System.Drawing.Size(76, 13); + this.AvailableFMsLabel.TabIndex = 1; + this.AvailableFMsLabel.Text = "Available FMs:"; + // + // T1Label + // + this.T1Label.AutoSize = true; + this.T1Label.Location = new System.Drawing.Point(64, 99); + this.T1Label.Name = "T1Label"; + this.T1Label.Size = new System.Drawing.Size(43, 13); + this.T1Label.TabIndex = 1; + this.T1Label.Text = "Thief 1:"; + // + // T2Label + // + this.T2Label.AutoSize = true; + this.T2Label.Location = new System.Drawing.Point(64, 123); + this.T2Label.Name = "T2Label"; + this.T2Label.Size = new System.Drawing.Size(43, 13); + this.T2Label.TabIndex = 1; + this.T2Label.Text = "Thief 2:"; + // + // T3Label + // + this.T3Label.AutoSize = true; + this.T3Label.Location = new System.Drawing.Point(64, 147); + this.T3Label.Name = "T3Label"; + this.T3Label.Size = new System.Drawing.Size(43, 13); + this.T3Label.TabIndex = 1; + this.T3Label.Text = "Thief 3:"; + // + // SS2Label + // + this.SS2Label.AutoSize = true; + this.SS2Label.Location = new System.Drawing.Point(64, 171); + this.SS2Label.Name = "SS2Label"; + this.SS2Label.Size = new System.Drawing.Size(87, 13); + this.SS2Label.TabIndex = 1; + this.SS2Label.Text = "System Shock 2:"; + // + // UnscannedLabel + // + this.UnscannedLabel.AutoSize = true; + this.UnscannedLabel.Location = new System.Drawing.Point(64, 195); + this.UnscannedLabel.Name = "UnscannedLabel"; + this.UnscannedLabel.Size = new System.Drawing.Size(65, 13); + this.UnscannedLabel.TabIndex = 1; + this.UnscannedLabel.Text = "Unscanned:"; + // + // UnsupportedLabel + // + this.UnsupportedLabel.AutoSize = true; + this.UnsupportedLabel.Location = new System.Drawing.Point(64, 219); + this.UnsupportedLabel.Name = "UnsupportedLabel"; + this.UnsupportedLabel.Size = new System.Drawing.Size(115, 13); + this.UnsupportedLabel.TabIndex = 1; + this.UnsupportedLabel.Text = "Invalid or unsupported:"; + // + // AvailableFMsTextBox + // + this.AvailableFMsTextBox.Location = new System.Drawing.Point(200, 72); + this.AvailableFMsTextBox.Name = "AvailableFMsTextBox"; + this.AvailableFMsTextBox.ReadOnly = true; + this.AvailableFMsTextBox.Size = new System.Drawing.Size(100, 20); + this.AvailableFMsTextBox.TabIndex = 2; + // + // T1TextBox + // + this.T1TextBox.Location = new System.Drawing.Point(200, 96); + this.T1TextBox.Name = "T1TextBox"; + this.T1TextBox.ReadOnly = true; + this.T1TextBox.Size = new System.Drawing.Size(100, 20); + this.T1TextBox.TabIndex = 2; + // + // T2TextBox + // + this.T2TextBox.Location = new System.Drawing.Point(200, 120); + this.T2TextBox.Name = "T2TextBox"; + this.T2TextBox.ReadOnly = true; + this.T2TextBox.Size = new System.Drawing.Size(100, 20); + this.T2TextBox.TabIndex = 2; + // + // T3TextBox + // + this.T3TextBox.Location = new System.Drawing.Point(200, 144); + this.T3TextBox.Name = "T3TextBox"; + this.T3TextBox.ReadOnly = true; + this.T3TextBox.Size = new System.Drawing.Size(100, 20); + this.T3TextBox.TabIndex = 2; + // + // SS2TextBox + // + this.SS2TextBox.Location = new System.Drawing.Point(200, 168); + this.SS2TextBox.Name = "SS2TextBox"; + this.SS2TextBox.ReadOnly = true; + this.SS2TextBox.Size = new System.Drawing.Size(100, 20); + this.SS2TextBox.TabIndex = 2; + // + // UnscannedTextBox + // + this.UnscannedTextBox.Location = new System.Drawing.Point(200, 192); + this.UnscannedTextBox.Name = "UnscannedTextBox"; + this.UnscannedTextBox.ReadOnly = true; + this.UnscannedTextBox.Size = new System.Drawing.Size(100, 20); + this.UnscannedTextBox.TabIndex = 2; + // + // UnsupportedTextBox + // + this.UnsupportedTextBox.Location = new System.Drawing.Point(200, 216); + this.UnsupportedTextBox.Name = "UnsupportedTextBox"; + this.UnsupportedTextBox.ReadOnly = true; + this.UnsupportedTextBox.Size = new System.Drawing.Size(100, 20); + this.UnsupportedTextBox.TabIndex = 2; + // + // FMsInDatabaseLabel + // + this.FMsInDatabaseLabel.AutoSize = true; + this.FMsInDatabaseLabel.Location = new System.Drawing.Point(64, 51); + this.FMsInDatabaseLabel.Name = "FMsInDatabaseLabel"; + this.FMsInDatabaseLabel.Size = new System.Drawing.Size(88, 13); + this.FMsInDatabaseLabel.TabIndex = 1; + this.FMsInDatabaseLabel.Text = "FMs in database:"; + // + // FMsInDatabaseTextBox + // + this.FMsInDatabaseTextBox.Location = new System.Drawing.Point(200, 48); + this.FMsInDatabaseTextBox.Name = "FMsInDatabaseTextBox"; + this.FMsInDatabaseTextBox.ReadOnly = true; + this.FMsInDatabaseTextBox.Size = new System.Drawing.Size(100, 20); + this.FMsInDatabaseTextBox.TabIndex = 2; // // FMsListStatsForm // @@ -118,13 +201,22 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.OKButton; this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); + this.Controls.Add(this.UnsupportedTextBox); + this.Controls.Add(this.UnscannedTextBox); + this.Controls.Add(this.T3TextBox); + this.Controls.Add(this.SS2TextBox); + this.Controls.Add(this.T1TextBox); + this.Controls.Add(this.T2TextBox); + this.Controls.Add(this.FMsInDatabaseTextBox); + this.Controls.Add(this.AvailableFMsTextBox); + this.Controls.Add(this.UnsupportedLabel); + this.Controls.Add(this.UnscannedLabel); + this.Controls.Add(this.SS2Label); + this.Controls.Add(this.T3Label); + this.Controls.Add(this.T2Label); + this.Controls.Add(this.T1Label); + this.Controls.Add(this.FMsInDatabaseLabel); + this.Controls.Add(this.AvailableFMsLabel); this.Controls.Add(this.OKButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; @@ -140,12 +232,21 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Button OKButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label AvailableFMsLabel; + private System.Windows.Forms.Label T1Label; + private System.Windows.Forms.Label T2Label; + private System.Windows.Forms.Label T3Label; + private System.Windows.Forms.Label SS2Label; + private System.Windows.Forms.Label UnscannedLabel; + private System.Windows.Forms.Label UnsupportedLabel; + private System.Windows.Forms.TextBox AvailableFMsTextBox; + private System.Windows.Forms.TextBox T1TextBox; + private System.Windows.Forms.TextBox T2TextBox; + private System.Windows.Forms.TextBox T3TextBox; + private System.Windows.Forms.TextBox SS2TextBox; + private System.Windows.Forms.TextBox UnscannedTextBox; + private System.Windows.Forms.TextBox UnsupportedTextBox; + private System.Windows.Forms.Label FMsInDatabaseLabel; + private System.Windows.Forms.TextBox FMsInDatabaseTextBox; } } \ No newline at end of file diff --git a/AngelLoader/Forms/FMsListStatsForm.cs b/AngelLoader/Forms/FMsListStatsForm.cs index 9d576da19..f06c1c040 100644 --- a/AngelLoader/Forms/FMsListStatsForm.cs +++ b/AngelLoader/Forms/FMsListStatsForm.cs @@ -7,14 +7,63 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using AngelLoader.DataClasses; +using static AngelLoader.GameSupport; +using static AngelLoader.Misc; namespace AngelLoader.Forms { - public partial class FMsListStatsForm : Form + public sealed partial class FMsListStatsForm : Form { public FMsListStatsForm() { InitializeComponent(); + CalculateStats(); + } + + private void CalculateStats() + { + FMsInDatabaseTextBox.Text = FMDataIniList.Count.ToString(); + AvailableFMsTextBox.Text = FMsViewList.Count.ToString(); + + int t1FMs = 0; + int t2FMs = 0; + int t3FMs = 0; + int ss2FMs = 0; + int unscannedFMs = 0; + int unsupportedFMs = 0; + for (int i = 0; i < FMsViewList.Count; i++) + { + FanMission fm = FMsViewList[i]; + switch (fm.Game) + { + case Game.Thief1: + t1FMs++; + break; + case Game.Thief2: + t2FMs++; + break; + case Game.Thief3: + t3FMs++; + break; + case Game.SS2: + ss2FMs++; + break; + case Game.Null: + unscannedFMs++; + break; + case Game.Unsupported: + unsupportedFMs++; + break; + } + } + + T1TextBox.Text = t1FMs.ToString(); + T2TextBox.Text = t2FMs.ToString(); + T3TextBox.Text = t3FMs.ToString(); + SS2TextBox.Text = ss2FMs.ToString(); + UnscannedTextBox.Text = unscannedFMs.ToString(); + UnsupportedTextBox.Text = unsupportedFMs.ToString(); } } } diff --git a/AngelLoader/Forms/MainForm.cs b/AngelLoader/Forms/MainForm.cs index 603e66ae1..53f4a66f0 100644 --- a/AngelLoader/Forms/MainForm.cs +++ b/AngelLoader/Forms/MainForm.cs @@ -1524,6 +1524,8 @@ private void MainMenuButton_Click(object sender, EventArgs e) ShowMenu(MainLLMenu.Menu, MainMenuButton, MenuPos.BottomRight, xOffset: -2, yOffset: 2); } + private void MainMenuButton_Enter(object sender, EventArgs e) => MainMenuButton.HideFocusRectangle(); + [SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Global")] internal void MainMenu_GameVersionsMenuItem_Click(object sender, EventArgs e) { @@ -1531,7 +1533,12 @@ internal void MainMenu_GameVersionsMenuItem_Click(object sender, EventArgs e) f.ShowDialog(); } - private void MainMenuButton_Enter(object sender, EventArgs e) => MainMenuButton.HideFocusRectangle(); + [SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Global")] + internal void FMsListStatsMenuItem_Click(object sender, EventArgs e) + { + using var f = new FMsListStatsForm(); + f.ShowDialog(); + } #endregion @@ -4215,10 +4222,5 @@ private void RefreshAreaToolStrip_Paint(object sender, PaintEventArgs e) void ZoomResetButtons_Paint(object sender, PaintEventArgs e) => ControlPainter.PaintZoomButtons((Button)sender, e, Zoom.Reset); #endregion - - internal void FMsListStatsMenuItem_Click(object sender, EventArgs e) - { - - } } }