From 86344e34bf6da4385337d89b8feac0b19b9c8483 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 15 May 2026 22:18:15 +0100 Subject: [PATCH] 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 @@ -