mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
make startup more verbose
This commit is contained in:
parent
51ededbf20
commit
f768f0a1bb
@ -291,15 +291,21 @@ namespace Bloxstrap
|
|||||||
if (installLocation is null)
|
if (installLocation is null)
|
||||||
{
|
{
|
||||||
Logger.Initialize(true);
|
Logger.Initialize(true);
|
||||||
|
Logger.WriteLine(LOG_IDENT, "Not installed, launching the installer");
|
||||||
LaunchHandler.LaunchInstaller();
|
LaunchHandler.LaunchInstaller();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Paths.Initialize(installLocation);
|
Paths.Initialize(installLocation);
|
||||||
|
|
||||||
|
Logger.WriteLine(LOG_IDENT, "Entering main logic");
|
||||||
|
|
||||||
// ensure executable is in the install directory
|
// ensure executable is in the install directory
|
||||||
if (Paths.Process != Paths.Application && !File.Exists(Paths.Application))
|
if (Paths.Process != Paths.Application && !File.Exists(Paths.Application))
|
||||||
|
{
|
||||||
|
Logger.WriteLine(LOG_IDENT, "Copying to install directory");
|
||||||
File.Copy(Paths.Process, Paths.Application);
|
File.Copy(Paths.Process, Paths.Application);
|
||||||
|
}
|
||||||
|
|
||||||
Logger.Initialize(LaunchSettings.UninstallFlag.Active);
|
Logger.Initialize(LaunchSettings.UninstallFlag.Active);
|
||||||
|
|
||||||
@ -328,6 +334,7 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
// you must *explicitly* call terminate when everything is done, it won't be called implicitly
|
// you must *explicitly* call terminate when everything is done, it won't be called implicitly
|
||||||
|
Logger.WriteLine(LOG_IDENT, "Startup finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,21 +11,27 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
public static void ProcessNextAction(NextAction action, bool isUnfinishedInstall = false)
|
public static void ProcessNextAction(NextAction action, bool isUnfinishedInstall = false)
|
||||||
{
|
{
|
||||||
|
const string LOG_IDENT = "LaunchHandler::ProcessNextAction";
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case NextAction.LaunchSettings:
|
case NextAction.LaunchSettings:
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening settings");
|
||||||
LaunchSettings();
|
LaunchSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NextAction.LaunchRoblox:
|
case NextAction.LaunchRoblox:
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening Roblox");
|
||||||
LaunchRoblox(LaunchMode.Player);
|
LaunchRoblox(LaunchMode.Player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NextAction.LaunchRobloxStudio:
|
case NextAction.LaunchRobloxStudio:
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening Roblox Studio");
|
||||||
LaunchRoblox(LaunchMode.Studio);
|
LaunchRoblox(LaunchMode.Studio);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Closing");
|
||||||
App.Terminate(isUnfinishedInstall ? ErrorCode.ERROR_INSTALL_USEREXIT : ErrorCode.ERROR_SUCCESS);
|
App.Terminate(isUnfinishedInstall ? ErrorCode.ERROR_INSTALL_USEREXIT : ErrorCode.ERROR_SUCCESS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -33,21 +39,41 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public static void ProcessLaunchArgs()
|
public static void ProcessLaunchArgs()
|
||||||
{
|
{
|
||||||
|
const string LOG_IDENT = "LaunchHandler::ProcessLaunchArgs";
|
||||||
|
|
||||||
// this order is specific
|
// this order is specific
|
||||||
|
|
||||||
if (App.LaunchSettings.UninstallFlag.Active)
|
if (App.LaunchSettings.UninstallFlag.Active)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening uninstaller");
|
||||||
LaunchUninstaller();
|
LaunchUninstaller();
|
||||||
|
}
|
||||||
else if (App.LaunchSettings.MenuFlag.Active)
|
else if (App.LaunchSettings.MenuFlag.Active)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening settings");
|
||||||
LaunchSettings();
|
LaunchSettings();
|
||||||
|
}
|
||||||
else if (App.LaunchSettings.WatcherFlag.Active)
|
else if (App.LaunchSettings.WatcherFlag.Active)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening watcher");
|
||||||
LaunchWatcher();
|
LaunchWatcher();
|
||||||
|
}
|
||||||
else if (App.LaunchSettings.RobloxLaunchMode != LaunchMode.None)
|
else if (App.LaunchSettings.RobloxLaunchMode != LaunchMode.None)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Opening bootstrapper ({App.LaunchSettings.RobloxLaunchMode})");
|
||||||
LaunchRoblox(App.LaunchSettings.RobloxLaunchMode);
|
LaunchRoblox(App.LaunchSettings.RobloxLaunchMode);
|
||||||
|
}
|
||||||
else if (!App.LaunchSettings.QuietFlag.Active)
|
else if (!App.LaunchSettings.QuietFlag.Active)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Opening menu");
|
||||||
LaunchMenu();
|
LaunchMenu();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Closing - quiet flag active");
|
||||||
App.Terminate();
|
App.Terminate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void LaunchInstaller()
|
public static void LaunchInstaller()
|
||||||
{
|
{
|
||||||
@ -235,6 +261,8 @@ namespace Bloxstrap
|
|||||||
});
|
});
|
||||||
|
|
||||||
dialog?.ShowBootstrapper();
|
dialog?.ShowBootstrapper();
|
||||||
|
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Exiting");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LaunchWatcher()
|
public static void LaunchWatcher()
|
||||||
|
@ -72,6 +72,8 @@ namespace Bloxstrap
|
|||||||
_flagMap.Add(identifier, flag);
|
_flagMap.Add(identifier, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int startIdx = 0;
|
||||||
|
|
||||||
// infer roblox launch uris
|
// infer roblox launch uris
|
||||||
if (Args.Length >= 1)
|
if (Args.Length >= 1)
|
||||||
{
|
{
|
||||||
@ -80,23 +82,31 @@ namespace Bloxstrap
|
|||||||
if (arg.StartsWith("roblox:", StringComparison.OrdinalIgnoreCase)
|
if (arg.StartsWith("roblox:", StringComparison.OrdinalIgnoreCase)
|
||||||
|| arg.StartsWith("roblox-player:", StringComparison.OrdinalIgnoreCase))
|
|| arg.StartsWith("roblox-player:", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Got Roblox player argument");
|
||||||
RobloxLaunchMode = LaunchMode.Player;
|
RobloxLaunchMode = LaunchMode.Player;
|
||||||
RobloxLaunchArgs = arg;
|
RobloxLaunchArgs = arg;
|
||||||
|
startIdx = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse
|
// parse
|
||||||
for (int i = 0; i < Args.Length; i++)
|
for (int i = startIdx; i < Args.Length; i++)
|
||||||
{
|
{
|
||||||
string arg = Args[i];
|
string arg = Args[i];
|
||||||
|
|
||||||
if (!arg.StartsWith('-'))
|
if (!arg.StartsWith('-'))
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Invalid argument: {arg}");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
string identifier = arg[1..];
|
string identifier = arg[1..];
|
||||||
|
|
||||||
if (!_flagMap.TryGetValue(identifier, out LaunchFlag? flag) || flag is null)
|
if (!_flagMap.TryGetValue(identifier, out LaunchFlag? flag) || flag is null)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Unknown argument: {identifier}");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
flag.Active = true;
|
flag.Active = true;
|
||||||
|
|
||||||
@ -119,31 +129,48 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
private void ParsePlayer(string? data)
|
private void ParsePlayer(string? data)
|
||||||
{
|
{
|
||||||
|
const string LOG_IDENT = "LaunchSettings::ParsePlayer";
|
||||||
|
|
||||||
RobloxLaunchMode = LaunchMode.Player;
|
RobloxLaunchMode = LaunchMode.Player;
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(data))
|
if (!String.IsNullOrEmpty(data))
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Got Roblox launch arguments");
|
||||||
RobloxLaunchArgs = data;
|
RobloxLaunchArgs = data;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "No Roblox launch arguments were provided");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ParseStudio(string? data)
|
private void ParseStudio(string? data)
|
||||||
{
|
{
|
||||||
|
const string LOG_IDENT = "LaunchSettings::ParseStudio";
|
||||||
|
|
||||||
RobloxLaunchMode = LaunchMode.Studio;
|
RobloxLaunchMode = LaunchMode.Studio;
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(data))
|
if (String.IsNullOrEmpty(data))
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "No Roblox launch arguments were provided");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.StartsWith("roblox-studio:"))
|
if (data.StartsWith("roblox-studio:"))
|
||||||
{
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Got Roblox Studio launch arguments");
|
||||||
RobloxLaunchArgs = data;
|
RobloxLaunchArgs = data;
|
||||||
}
|
}
|
||||||
else if (data.StartsWith("roblox-studio-auth:"))
|
else if (data.StartsWith("roblox-studio-auth:"))
|
||||||
{
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Got Roblox Studio Auth launch arguments");
|
||||||
RobloxLaunchMode = LaunchMode.StudioAuth;
|
RobloxLaunchMode = LaunchMode.StudioAuth;
|
||||||
RobloxLaunchArgs = data;
|
RobloxLaunchArgs = data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// likely a local path
|
// likely a local path
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Got Roblox Studio local place file");
|
||||||
RobloxLaunchArgs = $"-task EditFile -localPlaceFile \"{data}\"";
|
RobloxLaunchArgs = $"-task EditFile -localPlaceFile \"{data}\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user