From 86344e34bf6da4385337d89b8feac0b19b9c8483 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 15 May 2026 22:18:15 +0100 Subject: [PATCH 1/2] Changed to remove DI to optimise binary size --- MainForm.cs | 23 +++++------------------ Program.cs | 13 +------------ RokettoLaunch.csproj | 1 - 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index 1bff967..2e09c78 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -6,7 +6,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; -using Microsoft.Extensions.DependencyInjection; using RokettoLaunch.Models.SaveFile; using RokettoLaunch.Windows.Forms; using RyzStudio; @@ -18,7 +17,6 @@ namespace RokettoLaunch { public partial class MainForm : Form { - private readonly IServiceProvider _provider; private readonly IFileSessionManager _fileSessionManager; private bool _isBusy = false; @@ -30,22 +28,10 @@ namespace RokettoLaunch InitializeComponent(); this.AutoScaleMode = AutoScaleMode.None; + this.StartPosition = FormStartPosition.WindowsDefaultLocation; this.Text = Application.ProductName; - this.CurrentSession = new App4Options(); - -//#if DEBUG - //flowLayoutPanel1.BackColor = Color.LightGreen; -//#endif - - notifyIcon1.Text = Application.ProductName; - } - - public MainForm(IServiceProvider provider, IFileSessionManager fileSessionManager) : this() - { - _provider = provider; - _fileSessionManager = fileSessionManager; - + _fileSessionManager = new FileSessionManager(); _fileSessionManager.OpenFileDialog = openFileDialog1; _fileSessionManager.SaveFileDialog = saveFileDialog1; _fileSessionManager.OnNewing += fileSessionManager_OnNewSession; @@ -53,6 +39,8 @@ namespace RokettoLaunch _fileSessionManager.OnSaving += fileSessionManager_OnSaveSession; _fileSessionManager.OnClearing += fileSessionManager_OnClearSession; _fileSessionManager.OnFilenameChanged += fileSessionManager_OnFilenameChanged; + + notifyIcon1.Text = Application.ProductName; } protected async override void OnShown(EventArgs e) @@ -435,8 +423,7 @@ namespace RokettoLaunch private async Task fileSessionManager_OnLoadSession(FileSessionManager sender, string filename, int formatType) { - // Progress indicator - var loadingForm = _provider.GetRequiredService(); + var loadingForm = new LoadingForm(); var result = await loadingForm.ShowDialog(filename); if (result != DialogResult.OK) { diff --git a/Program.cs b/Program.cs index fbc2799..9470017 100644 --- a/Program.cs +++ b/Program.cs @@ -1,7 +1,5 @@ using System; using System.Windows.Forms; -using Microsoft.Extensions.DependencyInjection; -using RyzStudio.Windows.Forms; namespace RokettoLaunch { @@ -13,19 +11,10 @@ namespace RokettoLaunch [STAThread] static void Main() { - var services = new ServiceCollection(); - services.AddSingleton(); - services.AddTransient(); - services.AddTransient(); - - var provider = services.BuildServiceProvider(); - Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - //Application.Run(new MainForm()); - - Application.Run(provider.GetRequiredService()); + Application.Run(new MainForm()); } } } diff --git a/RokettoLaunch.csproj b/RokettoLaunch.csproj index f3d3df9..0336602 100644 --- a/RokettoLaunch.csproj +++ b/RokettoLaunch.csproj @@ -79,7 +79,6 @@ - From 71693de736bc374e920426a0b1a0763aae8d4fd7 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 15 May 2026 22:34:10 +0100 Subject: [PATCH 2/2] Changed to move forms to its own namespace Fixed new session bug --- {Models => DTOs}/SaveFile/App3Options.cs | 2 +- {Models => DTOs}/SaveFile/App4Options.cs | 2 +- {Models => DTOs}/SaveFile/AppOptionsBase.cs | 2 +- CopyToTileForm.cs => Forms/CopyToTileForm.cs | 2 +- .../CopyToTileForm.resx | 0 EditFolderForm.cs => Forms/EditFolderForm.cs | 4 +- .../EditFolderForm.resx | 0 EditGroupForm.cs => Forms/EditGroupForm.cs | 4 +- .../EditGroupForm.resx | 0 EditTileForm.cs => Forms/EditTileForm.cs | 4 +- EditTileForm.resx => Forms/EditTileForm.resx | 0 LoadingForm.cs => Forms/LoadingForm.cs | 4 +- LoadingForm.resx => Forms/LoadingForm.resx | 0 OptionsForm.cs => Forms/OptionsForm.cs | 4 +- OptionsForm.resx => Forms/OptionsForm.resx | 0 MainForm.cs | 55 ++++++++++++------- Models/NewFormModel.cs | 10 ---- RokettoLaunch.csproj | 19 ++----- 18 files changed, 54 insertions(+), 58 deletions(-) rename {Models => DTOs}/SaveFile/App3Options.cs (97%) rename {Models => DTOs}/SaveFile/App4Options.cs (99%) rename {Models => DTOs}/SaveFile/AppOptionsBase.cs (94%) rename CopyToTileForm.cs => Forms/CopyToTileForm.cs (99%) rename CopyToTileForm.resx => Forms/CopyToTileForm.resx (100%) rename EditFolderForm.cs => Forms/EditFolderForm.cs (99%) rename EditFolderForm.resx => Forms/EditFolderForm.resx (100%) rename EditGroupForm.cs => Forms/EditGroupForm.cs (99%) rename EditGroupForm.resx => Forms/EditGroupForm.resx (100%) rename EditTileForm.cs => Forms/EditTileForm.cs (99%) rename EditTileForm.resx => Forms/EditTileForm.resx (100%) rename LoadingForm.cs => Forms/LoadingForm.cs (99%) rename LoadingForm.resx => Forms/LoadingForm.resx (100%) rename OptionsForm.cs => Forms/OptionsForm.cs (99%) rename OptionsForm.resx => Forms/OptionsForm.resx (100%) delete mode 100644 Models/NewFormModel.cs diff --git a/Models/SaveFile/App3Options.cs b/DTOs/SaveFile/App3Options.cs similarity index 97% rename from Models/SaveFile/App3Options.cs rename to DTOs/SaveFile/App3Options.cs index d77d22c..1ac100e 100644 --- a/Models/SaveFile/App3Options.cs +++ b/DTOs/SaveFile/App3Options.cs @@ -3,7 +3,7 @@ using System.Diagnostics; using System.Drawing; using System.Text.Json.Serialization; -namespace RokettoLaunch.Models.SaveFile +namespace RokettoLaunch.DTOs.SaveFile { public class App3Options : AppOptionsBase { diff --git a/Models/SaveFile/App4Options.cs b/DTOs/SaveFile/App4Options.cs similarity index 99% rename from Models/SaveFile/App4Options.cs rename to DTOs/SaveFile/App4Options.cs index 828719d..91f7896 100644 --- a/Models/SaveFile/App4Options.cs +++ b/DTOs/SaveFile/App4Options.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; -namespace RokettoLaunch.Models.SaveFile +namespace RokettoLaunch.DTOs.SaveFile { public class App4Options : AppOptionsBase { diff --git a/Models/SaveFile/AppOptionsBase.cs b/DTOs/SaveFile/AppOptionsBase.cs similarity index 94% rename from Models/SaveFile/AppOptionsBase.cs rename to DTOs/SaveFile/AppOptionsBase.cs index cf60c20..6ba5c1e 100644 --- a/Models/SaveFile/AppOptionsBase.cs +++ b/DTOs/SaveFile/AppOptionsBase.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace RokettoLaunch.Models.SaveFile +namespace RokettoLaunch.DTOs.SaveFile { public class AppOptionsBase { diff --git a/CopyToTileForm.cs b/Forms/CopyToTileForm.cs similarity index 99% rename from CopyToTileForm.cs rename to Forms/CopyToTileForm.cs index 6ef750f..a7342f7 100644 --- a/CopyToTileForm.cs +++ b/Forms/CopyToTileForm.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; using RyzStudio.Windows.Forms; using RyzStudio.Windows.ThemedForms; -namespace RokettoLaunch +namespace RokettoLaunch.Forms { public class CopyToTileForm : Form { diff --git a/CopyToTileForm.resx b/Forms/CopyToTileForm.resx similarity index 100% rename from CopyToTileForm.resx rename to Forms/CopyToTileForm.resx diff --git a/EditFolderForm.cs b/Forms/EditFolderForm.cs similarity index 99% rename from EditFolderForm.cs rename to Forms/EditFolderForm.cs index 045285d..9edf088 100644 --- a/EditFolderForm.cs +++ b/Forms/EditFolderForm.cs @@ -5,12 +5,12 @@ using System.Drawing; using System.IO; using System.Linq; using System.Windows.Forms; -using RokettoLaunch.Models.SaveFile; +using RokettoLaunch.DTOs.SaveFile; using RyzStudio.Windows.Forms; using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms.ButtonTextBox; -namespace RokettoLaunch +namespace RokettoLaunch.Forms { public class EditFolderForm : Form { diff --git a/EditFolderForm.resx b/Forms/EditFolderForm.resx similarity index 100% rename from EditFolderForm.resx rename to Forms/EditFolderForm.resx diff --git a/EditGroupForm.cs b/Forms/EditGroupForm.cs similarity index 99% rename from EditGroupForm.cs rename to Forms/EditGroupForm.cs index 744e0cf..8f7affc 100644 --- a/EditGroupForm.cs +++ b/Forms/EditGroupForm.cs @@ -1,12 +1,12 @@ using System; using System.Windows.Forms; -using RokettoLaunch.Models.SaveFile; +using RokettoLaunch.DTOs.SaveFile; using RokettoLaunch.Windows.Forms; using RyzStudio.Windows.Forms; using RyzStudio.Windows.ThemedForms.ButtonTextBox; using RyzStudio.Windows.ThemedForms.PickerBox; -namespace RokettoLaunch +namespace RokettoLaunch.Forms { public class EditGroupForm : Form { diff --git a/EditGroupForm.resx b/Forms/EditGroupForm.resx similarity index 100% rename from EditGroupForm.resx rename to Forms/EditGroupForm.resx diff --git a/EditTileForm.cs b/Forms/EditTileForm.cs similarity index 99% rename from EditTileForm.cs rename to Forms/EditTileForm.cs index 3b936f5..29058db 100644 --- a/EditTileForm.cs +++ b/Forms/EditTileForm.cs @@ -2,13 +2,13 @@ using System.Diagnostics; using System.Drawing; using System.Windows.Forms; -using RokettoLaunch.Models.SaveFile; +using RokettoLaunch.DTOs.SaveFile; using RyzStudio.Windows.Forms; using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms.ButtonTextBox; using RyzStudio.Windows.ThemedForms.PickerBox; -namespace RokettoLaunch +namespace RokettoLaunch.Forms { public class EditTileForm : Form { diff --git a/EditTileForm.resx b/Forms/EditTileForm.resx similarity index 100% rename from EditTileForm.resx rename to Forms/EditTileForm.resx diff --git a/LoadingForm.cs b/Forms/LoadingForm.cs similarity index 99% rename from LoadingForm.cs rename to Forms/LoadingForm.cs index ba81cf6..ea7d32a 100644 --- a/LoadingForm.cs +++ b/Forms/LoadingForm.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using System.Windows.Forms; -using RokettoLaunch.Models.SaveFile; +using RokettoLaunch.DTOs.SaveFile; using RyzStudio.Windows.Forms; -namespace RokettoLaunch +namespace RokettoLaunch.Forms { public class LoadingForm : Form { diff --git a/LoadingForm.resx b/Forms/LoadingForm.resx similarity index 100% rename from LoadingForm.resx rename to Forms/LoadingForm.resx diff --git a/OptionsForm.cs b/Forms/OptionsForm.cs similarity index 99% rename from OptionsForm.cs rename to Forms/OptionsForm.cs index 38b71fc..33dd3e3 100644 --- a/OptionsForm.cs +++ b/Forms/OptionsForm.cs @@ -1,12 +1,12 @@ using System; using System.Windows.Forms; -using RokettoLaunch.Models.SaveFile; +using RokettoLaunch.DTOs.SaveFile; using RyzStudio.Windows.Forms; using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms.ButtonTextBox; using RyzStudio.Windows.ThemedForms.PickerBox; -namespace RokettoLaunch +namespace RokettoLaunch.Forms { public class OptionsForm : Form { diff --git a/OptionsForm.resx b/Forms/OptionsForm.resx similarity index 100% rename from OptionsForm.resx rename to Forms/OptionsForm.resx diff --git a/MainForm.cs b/MainForm.cs index 2e09c78..e6eada2 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -6,7 +6,8 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; -using RokettoLaunch.Models.SaveFile; +using RokettoLaunch.DTOs.SaveFile; +using RokettoLaunch.Forms; using RokettoLaunch.Windows.Forms; using RyzStudio; using RyzStudio.Windows.Forms; @@ -19,8 +20,9 @@ namespace RokettoLaunch { private readonly IFileSessionManager _fileSessionManager; - private bool _isBusy = false; - private bool _requestExit = false; + private App4Options currentSession = null; + private bool isBusy = false; + private bool requestExit = false; public MainForm() @@ -76,7 +78,7 @@ namespace RokettoLaunch this.CurrentSession = new App4Options(); } - if (this.CurrentSession.HideOnClose && !_requestExit) + if (this.CurrentSession.HideOnClose && !requestExit) { this.Hide(); @@ -84,7 +86,7 @@ namespace RokettoLaunch return; } - _requestExit = false; + requestExit = false; var result = await _fileSessionManager.CloseSession(); if (!result) @@ -113,7 +115,7 @@ namespace RokettoLaunch break; case RyzStudio.Runtime.InteropServices.User32.WM_QUERYENDSESSION: - _requestExit = true; + requestExit = true; Application.Exit(); @@ -127,8 +129,19 @@ namespace RokettoLaunch [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public App4Options CurrentSession { get; set; } = null; + public App4Options CurrentSession + { + get + { + if (currentSession == null) + { + currentSession = new App4Options(); + } + return currentSession; + } + set => currentSession = value; + } private void InvalidateOptions(bool resize) { @@ -193,7 +206,7 @@ namespace RokettoLaunch /// private async void NewToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } @@ -208,7 +221,7 @@ namespace RokettoLaunch /// private async void OpenToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } @@ -223,7 +236,7 @@ namespace RokettoLaunch /// private async void CloseToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } @@ -238,7 +251,7 @@ namespace RokettoLaunch /// private async void SaveToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } @@ -253,7 +266,7 @@ namespace RokettoLaunch /// private async void SaveAsToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } @@ -268,12 +281,12 @@ namespace RokettoLaunch /// private void ExitToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } - _requestExit = true; + requestExit = true; this.Close(); } @@ -392,12 +405,12 @@ namespace RokettoLaunch private void NotifyExitToolStripMenuItem_Click(object sender, EventArgs e) { - if (_isBusy) + if (isBusy) { return; } - _requestExit = true; + requestExit = true; this.Close(); } @@ -460,12 +473,12 @@ namespace RokettoLaunch return await Task.Run(async () => { - if (_isBusy) + if (isBusy) { return false; } - _isBusy = true; + isBusy = true; // update session if (this.CurrentSession == null) @@ -517,7 +530,7 @@ namespace RokettoLaunch } } - _isBusy = false; + isBusy = false; return result.IsSuccess; }); @@ -711,7 +724,7 @@ namespace RokettoLaunch return; } - _isBusy = true; + isBusy = true; await Task.Run(() => { @@ -722,7 +735,7 @@ namespace RokettoLaunch }); _fileSessionManager.HasChanged = true; - _isBusy = false; + isBusy = false; } /// diff --git a/Models/NewFormModel.cs b/Models/NewFormModel.cs deleted file mode 100644 index 7756338..0000000 --- a/Models/NewFormModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace RokettoLaunch.Models -{ - public class NewFormModel - { - public int ColumnCount { get; set; } = 8; - - public int GroupCount { get; set; } = 1; - - } -} \ No newline at end of file diff --git a/RokettoLaunch.csproj b/RokettoLaunch.csproj index 0336602..9905373 100644 --- a/RokettoLaunch.csproj +++ b/RokettoLaunch.csproj @@ -14,7 +14,7 @@ Ray Lam 1.0.0.0 1.0.0.0 - 0.4.1.0202 + 0.4.1.0217 False x64 icon-128.png @@ -31,15 +31,15 @@ - + - + - + @@ -88,10 +88,10 @@ True AppResource.resx - + Form - + Form @@ -103,11 +103,4 @@ - - - True - \ - - - \ No newline at end of file