diff --git a/Kiseki.Launcher.Windows/Bootstrapper.cs b/Kiseki.Launcher.Windows/Bootstrapper.cs index 4fc2f4d..e7e7946 100644 --- a/Kiseki.Launcher.Windows/Bootstrapper.cs +++ b/Kiseki.Launcher.Windows/Bootstrapper.cs @@ -92,7 +92,8 @@ public class Bootstrapper : Interfaces.IBootstrapper Directory.CreateDirectory(Directories.Versions); Directory.CreateDirectory(Directories.Logs); - File.Copy(Application.ExecutablePath, Directories.Application, true); + if (!File.Exists(Directories.Application)) + File.Copy(Application.ExecutablePath, Directories.Application, true); Register(); Protocol.Register(); @@ -210,14 +211,14 @@ public class Bootstrapper : Interfaces.IBootstrapper #endregion #region Licensing - public static void License() + public static bool License() { if (!File.Exists(Directories.License)) { if (!AskForLicense(Directories.License)) { // User doesn't want to license this launcher - return; + return false; } } @@ -229,6 +230,8 @@ public class Bootstrapper : Interfaces.IBootstrapper MessageBox.Show($"Corrupt license file! Please verify the contents of your license file (it should be named \"license.bin\".)", Constants.PROJECT_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); AskForLicense(Directories.License, false); } + + return true; } public static void Unlicense() diff --git a/Kiseki.Launcher.Windows/Directories.cs b/Kiseki.Launcher.Windows/Directories.cs index 2e931d9..3051ba4 100644 --- a/Kiseki.Launcher.Windows/Directories.cs +++ b/Kiseki.Launcher.Windows/Directories.cs @@ -22,7 +22,7 @@ public static class Directories Logs = Path.Combine(Base, "Logs"); Versions = Path.Combine(Base, "Versions"); - License = Path.Combine(Base, "license.bin"); + License = Path.Combine(Base, "License.bin"); Application = Path.Combine(Base, $"{Constants.PROJECT_NAME}.Launcher.exe"); } } \ No newline at end of file diff --git a/Kiseki.Launcher.Windows/Program.cs b/Kiseki.Launcher.Windows/Program.cs index 1c48cad..8fa53ee 100644 --- a/Kiseki.Launcher.Windows/Program.cs +++ b/Kiseki.Launcher.Windows/Program.cs @@ -8,12 +8,10 @@ internal static class Program static void Main(string[] args) { // Initialize directories - string parentFolder = Path.GetDirectoryName(Application.StartupPath)!; - - if (Path.GetDirectoryName(parentFolder)!.ToLower().Contains(Constants.PROJECT_NAME.ToLower())) + if (Path.GetFileName(Path.GetDirectoryName(Application.ExecutablePath))!.ToLower().Contains(Constants.PROJECT_NAME.ToLower())) { // Set to the current directory (user likely has installed the launcher, seeing as parent folder name contains the project name) - Directories.Initialize(parentFolder); + Directories.Initialize(Path.GetDirectoryName(Application.ExecutablePath)!); } else { @@ -25,7 +23,11 @@ internal static class Program if (!isConnected && Web.IsInMaintenance) { // Try licensing this launcher and attempt to connect again - Bootstrapper.License(); + if (!Bootstrapper.License()) + { + return; + } + isConnected = Web.Initialize(); } diff --git a/Kiseki.Launcher/Interfaces/IBootstrapper.cs b/Kiseki.Launcher/Interfaces/IBootstrapper.cs index 6d21116..7d22c93 100644 --- a/Kiseki.Launcher/Interfaces/IBootstrapper.cs +++ b/Kiseki.Launcher/Interfaces/IBootstrapper.cs @@ -22,6 +22,6 @@ public interface IBootstrapper static abstract void Unregister(); // Licensing the launcher - static abstract void License(); + static abstract bool License(); static abstract void Unlicense(); } \ No newline at end of file