From 23f7c9bec516997f11874646554dc82f260bc75b Mon Sep 17 00:00:00 2001 From: atrexus <110138304+atrexus@users.noreply.github.com> Date: Fri, 9 May 2025 16:01:13 -0400 Subject: [PATCH] Add `HideWindowIcons` and update some code. --- ReClass.NET/Forms/AboutForm.cs | 3 +- ReClass.NET/Forms/IconForm.cs | 13 ++- ReClass.NET/Forms/IconForm.resx | 120 +++++++++++++++++++++ ReClass.NET/Forms/ScannerForm.cs | 7 +- ReClass.NET/Forms/SettingsForm.Designer.cs | 51 +++++---- ReClass.NET/Forms/SettingsForm.cs | 1 + ReClass.NET/ReClass.NET.csproj | 3 + ReClass.NET/Settings.cs | 4 +- ReClass.NET/Util/SettingsSerializer.cs | 4 +- 9 files changed, 175 insertions(+), 31 deletions(-) create mode 100644 ReClass.NET/Forms/IconForm.resx diff --git a/ReClass.NET/Forms/AboutForm.cs b/ReClass.NET/Forms/AboutForm.cs index b6e800a4..30bde2bd 100644 --- a/ReClass.NET/Forms/AboutForm.cs +++ b/ReClass.NET/Forms/AboutForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Windows.Forms; using ReClassNET.UI; @@ -11,7 +11,6 @@ public AboutForm() { InitializeComponent(); - bannerBox.Icon = Properties.Resources.ReClassNet.ToBitmap(); bannerBox.Title = Constants.ApplicationName; bannerBox.Text = $"Version: {Constants.ApplicationVersion}"; diff --git a/ReClass.NET/Forms/IconForm.cs b/ReClass.NET/Forms/IconForm.cs index 5184adb7..68578ae6 100644 --- a/ReClass.NET/Forms/IconForm.cs +++ b/ReClass.NET/Forms/IconForm.cs @@ -1,4 +1,4 @@ -using System.Windows.Forms; +using System.Windows.Forms; namespace ReClassNET.Forms { @@ -6,7 +6,16 @@ public class IconForm : Form { public IconForm() { - Icon = Properties.Resources.ReClassNet; + if (Program.Settings.HideWindowIcons) + { + ShowIcon = false; + Icon = null; + } + else + { + ShowIcon = true; + Icon = Properties.Resources.ReClassNet; + } } } } diff --git a/ReClass.NET/Forms/IconForm.resx b/ReClass.NET/Forms/IconForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/IconForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/ScannerForm.cs b/ReClass.NET/Forms/ScannerForm.cs index 0fb4d430..d9b534d7 100644 --- a/ReClass.NET/Forms/ScannerForm.cs +++ b/ReClass.NET/Forms/ScannerForm.cs @@ -878,12 +878,7 @@ private static void FindWhatInteractsWithSelectedRecord(MemoryRecord record, boo } } - internal class InvalidInputException : Exception + internal class InvalidInputException(string input) : Exception($"'{input}' is not a valid input.") { - public InvalidInputException(string input) - : base($"'{input}' is not a valid input.") - { - - } } } diff --git a/ReClass.NET/Forms/SettingsForm.Designer.cs b/ReClass.NET/Forms/SettingsForm.Designer.cs index 82e4efd9..6b1cdd87 100644 --- a/ReClass.NET/Forms/SettingsForm.Designer.cs +++ b/ReClass.NET/Forms/SettingsForm.Designer.cs @@ -45,6 +45,7 @@ private void InitializeComponent() this.showIntegerCheckBox = new System.Windows.Forms.CheckBox(); this.showFloatCheckBox = new System.Windows.Forms.CheckBox(); this.displayGroupBox = new System.Windows.Forms.GroupBox(); + this.hideWindowIconsCheckBox = new System.Windows.Forms.CheckBox(); this.randomizeWindowTitleCheckBox = new System.Windows.Forms.CheckBox(); this.runAsAdminCheckBox = new System.Windows.Forms.CheckBox(); this.highlightChangedValuesCheckBox = new System.Windows.Forms.CheckBox(); @@ -83,6 +84,8 @@ private void InitializeComponent() this.backgroundLabel = new System.Windows.Forms.Label(); this.backgroundColorBox = new ReClassNET.Controls.ColorBox(); this.typeDefinitionsSettingsTabPage = new System.Windows.Forms.TabPage(); + this.utf32TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf32TextTypeTextBox = new System.Windows.Forms.TextBox(); this.nuintSettingsLabel = new System.Windows.Forms.Label(); this.nuintTypeTextBox = new System.Windows.Forms.TextBox(); this.nintSettingsLabel = new System.Windows.Forms.Label(); @@ -129,8 +132,6 @@ private void InitializeComponent() this.int8SettingsLabel = new System.Windows.Forms.Label(); this.int8TypeTextBox = new System.Windows.Forms.TextBox(); this.bannerBox = new ReClassNET.Controls.BannerBox(); - this.utf32TextSettingsLabel = new System.Windows.Forms.Label(); - this.utf32TextTypeTextBox = new System.Windows.Forms.TextBox(); this.settingsTabControl.SuspendLayout(); this.generalSettingsTabPage.SuspendLayout(); this.fileAssociationGroupBox.SuspendLayout(); @@ -298,6 +299,7 @@ private void InitializeComponent() // // displayGroupBox // + this.displayGroupBox.Controls.Add(this.hideWindowIconsCheckBox); this.displayGroupBox.Controls.Add(this.randomizeWindowTitleCheckBox); this.displayGroupBox.Controls.Add(this.runAsAdminCheckBox); this.displayGroupBox.Controls.Add(this.highlightChangedValuesCheckBox); @@ -306,11 +308,21 @@ private void InitializeComponent() this.displayGroupBox.Controls.Add(this.showNodeAddressCheckBox); this.displayGroupBox.Location = new System.Drawing.Point(283, 39); this.displayGroupBox.Name = "displayGroupBox"; - this.displayGroupBox.Size = new System.Drawing.Size(265, 160); + this.displayGroupBox.Size = new System.Drawing.Size(265, 186); this.displayGroupBox.TabIndex = 2; this.displayGroupBox.TabStop = false; this.displayGroupBox.Text = "Display"; // + // hideWindowIconsCheckBox + // + this.hideWindowIconsCheckBox.AutoSize = true; + this.hideWindowIconsCheckBox.Location = new System.Drawing.Point(6, 157); + this.hideWindowIconsCheckBox.Name = "hideWindowIconsCheckBox"; + this.hideWindowIconsCheckBox.Size = new System.Drawing.Size(115, 17); + this.hideWindowIconsCheckBox.TabIndex = 6; + this.hideWindowIconsCheckBox.Text = "Hide window icons"; + this.hideWindowIconsCheckBox.UseVisualStyleBackColor = true; + // // randomizeWindowTitleCheckBox // this.randomizeWindowTitleCheckBox.AutoSize = true; @@ -724,6 +736,22 @@ private void InitializeComponent() this.typeDefinitionsSettingsTabPage.Text = "Type Definitions"; this.typeDefinitionsSettingsTabPage.UseVisualStyleBackColor = true; // + // utf32TextSettingsLabel + // + this.utf32TextSettingsLabel.AutoSize = true; + this.utf32TextSettingsLabel.Location = new System.Drawing.Point(254, 233); + this.utf32TextSettingsLabel.Name = "utf32TextSettingsLabel"; + this.utf32TextSettingsLabel.Size = new System.Drawing.Size(43, 13); + this.utf32TextSettingsLabel.TabIndex = 52; + this.utf32TextSettingsLabel.Text = "UTF32:"; + // + // utf32TextTypeTextBox + // + this.utf32TextTypeTextBox.Location = new System.Drawing.Point(346, 230); + this.utf32TextTypeTextBox.Name = "utf32TextTypeTextBox"; + this.utf32TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf32TextTypeTextBox.TabIndex = 51; + // // nuintSettingsLabel // this.nuintSettingsLabel.AutoSize = true; @@ -1096,22 +1124,6 @@ private void InitializeComponent() this.bannerBox.Text = "Configure the global settings."; this.bannerBox.Title = "Settings"; // - // utf32TextSettingsLabel - // - this.utf32TextSettingsLabel.AutoSize = true; - this.utf32TextSettingsLabel.Location = new System.Drawing.Point(254, 233); - this.utf32TextSettingsLabel.Name = "utf32TextSettingsLabel"; - this.utf32TextSettingsLabel.Size = new System.Drawing.Size(43, 13); - this.utf32TextSettingsLabel.TabIndex = 52; - this.utf32TextSettingsLabel.Text = "UTF32:"; - // - // utf32TextTypeTextBox - // - this.utf32TextTypeTextBox.Location = new System.Drawing.Point(346, 230); - this.utf32TextTypeTextBox.Name = "utf32TextTypeTextBox"; - this.utf32TextTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.utf32TextTypeTextBox.TabIndex = 51; - // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1247,5 +1259,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox nintTypeTextBox; private System.Windows.Forms.Label utf32TextSettingsLabel; private System.Windows.Forms.TextBox utf32TextTypeTextBox; + private System.Windows.Forms.CheckBox hideWindowIconsCheckBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/SettingsForm.cs b/ReClass.NET/Forms/SettingsForm.cs index fcc4121e..de29d32a 100644 --- a/ReClass.NET/Forms/SettingsForm.cs +++ b/ReClass.NET/Forms/SettingsForm.cs @@ -106,6 +106,7 @@ private void SetGeneralBindings() SetBinding(showPluginInfoCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentPluginInfo)); SetBinding(runAsAdminCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.RunAsAdmin)); SetBinding(randomizeWindowTitleCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.RandomizeWindowTitle)); + SetBinding(hideWindowIconsCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.HideWindowIcons)); } private void SetColorBindings() diff --git a/ReClass.NET/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj index 0c990cc2..2f70f875 100644 --- a/ReClass.NET/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -542,6 +542,9 @@ EnumSelectionForm.cs + + IconForm.cs + NamedAddressesForm.cs diff --git a/ReClass.NET/Settings.cs b/ReClass.NET/Settings.cs index b5d9268b..cf82aa86 100644 --- a/ReClass.NET/Settings.cs +++ b/ReClass.NET/Settings.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using System.Drawing; using System.Text; using ReClassNET.Util; @@ -16,6 +16,8 @@ public class Settings public bool RandomizeWindowTitle { get; set; } = false; + public bool HideWindowIcons { get; set; } = false; + // Node Drawing Settings public bool ShowNodeAddress { get; set; } = true; diff --git a/ReClass.NET/Util/SettingsSerializer.cs b/ReClass.NET/Util/SettingsSerializer.cs index 2a5a4e82..f39c0639 100644 --- a/ReClass.NET/Util/SettingsSerializer.cs +++ b/ReClass.NET/Util/SettingsSerializer.cs @@ -36,6 +36,7 @@ public static Settings Load() XElementSerializer.TryRead(general, nameof(settings.StayOnTop), e => settings.StayOnTop = XElementSerializer.ToBool(e)); XElementSerializer.TryRead(general, nameof(settings.RunAsAdmin), e => settings.RunAsAdmin = XElementSerializer.ToBool(e)); XElementSerializer.TryRead(general, nameof(settings.RandomizeWindowTitle), e => settings.RandomizeWindowTitle = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(general, nameof(settings.HideWindowIcons), e => settings.HideWindowIcons = XElementSerializer.ToBool(e)); } var display = root?.Element(XmlDisplayElement); if (display != null) @@ -107,7 +108,8 @@ public static void Save(Settings settings) XElementSerializer.ToXml(nameof(settings.LastProcess), settings.LastProcess), XElementSerializer.ToXml(nameof(settings.StayOnTop), settings.StayOnTop), XElementSerializer.ToXml(nameof(settings.RunAsAdmin), settings.RunAsAdmin), - XElementSerializer.ToXml(nameof(settings.RandomizeWindowTitle), settings.RandomizeWindowTitle) + XElementSerializer.ToXml(nameof(settings.RandomizeWindowTitle), settings.RandomizeWindowTitle), + XElementSerializer.ToXml(nameof(settings.HideWindowIcons), settings.HideWindowIcons) ), new XElement( XmlDisplayElement,