fix: various bugs
This commit is contained in:
parent
d34d14343d
commit
0350e39eca
|
|
@ -92,7 +92,8 @@ public class Bootstrapper : Interfaces.IBootstrapper
|
||||||
Directory.CreateDirectory(Directories.Versions);
|
Directory.CreateDirectory(Directories.Versions);
|
||||||
Directory.CreateDirectory(Directories.Logs);
|
Directory.CreateDirectory(Directories.Logs);
|
||||||
|
|
||||||
File.Copy(Application.ExecutablePath, Directories.Application, true);
|
if (!File.Exists(Directories.Application))
|
||||||
|
File.Copy(Application.ExecutablePath, Directories.Application, true);
|
||||||
|
|
||||||
Register();
|
Register();
|
||||||
Protocol.Register();
|
Protocol.Register();
|
||||||
|
|
@ -210,14 +211,14 @@ public class Bootstrapper : Interfaces.IBootstrapper
|
||||||
#endregion
|
#endregion
|
||||||
#region Licensing
|
#region Licensing
|
||||||
|
|
||||||
public static void License()
|
public static bool License()
|
||||||
{
|
{
|
||||||
if (!File.Exists(Directories.License))
|
if (!File.Exists(Directories.License))
|
||||||
{
|
{
|
||||||
if (!AskForLicense(Directories.License))
|
if (!AskForLicense(Directories.License))
|
||||||
{
|
{
|
||||||
// User doesn't want to license this launcher
|
// 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);
|
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);
|
AskForLicense(Directories.License, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Unlicense()
|
public static void Unlicense()
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public static class Directories
|
||||||
Logs = Path.Combine(Base, "Logs");
|
Logs = Path.Combine(Base, "Logs");
|
||||||
Versions = Path.Combine(Base, "Versions");
|
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");
|
Application = Path.Combine(Base, $"{Constants.PROJECT_NAME}.Launcher.exe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,12 +8,10 @@ internal static class Program
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
// Initialize directories
|
// Initialize directories
|
||||||
string parentFolder = Path.GetDirectoryName(Application.StartupPath)!;
|
if (Path.GetFileName(Path.GetDirectoryName(Application.ExecutablePath))!.ToLower().Contains(Constants.PROJECT_NAME.ToLower()))
|
||||||
|
|
||||||
if (Path.GetDirectoryName(parentFolder)!.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)
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -25,7 +23,11 @@ internal static class Program
|
||||||
if (!isConnected && Web.IsInMaintenance)
|
if (!isConnected && Web.IsInMaintenance)
|
||||||
{
|
{
|
||||||
// Try licensing this launcher and attempt to connect again
|
// Try licensing this launcher and attempt to connect again
|
||||||
Bootstrapper.License();
|
if (!Bootstrapper.License())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isConnected = Web.Initialize();
|
isConnected = Web.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ public interface IBootstrapper
|
||||||
static abstract void Unregister();
|
static abstract void Unregister();
|
||||||
|
|
||||||
// Licensing the launcher
|
// Licensing the launcher
|
||||||
static abstract void License();
|
static abstract bool License();
|
||||||
static abstract void Unlicense();
|
static abstract void Unlicense();
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue