Skip to content

Commit

Permalink
Merge branch 'main' into feature/taskbar-progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
bluepilledgreat committed Sep 22, 2024
2 parents afbe82b + ab6e3a0 commit 89fef19
Show file tree
Hide file tree
Showing 121 changed files with 3,828 additions and 2,404 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ body:
### **Preliminary instructions**
- Before opening an issue, please [check the Wiki first](https://github.com/pizzaboxer/bloxstrap/wiki/) to see if your problem has been addressed there.
- If it isn't, please confirm which pages that you read that were relevant to your issue.
- Your issue ***will*** be closed without warning if there's a Wiki page addressing your problem.
- If your problem is with Roblox itself (i.e. it crashes or doesn't launch), [check to see if it happens without Bloxstrap](https://github.com/pizzaboxer/bloxstrap/wiki/Roblox-crashes-or-does-not-launch).
- Please only open an issue if your problem happens only with Bloxstrap, and state clearly that this is the case, as anything else is out of my control.
- If you are getting a Bloxstrap Exception error, please attach a copy of the provided log file. There is a button on the dialog that locates it for you.
Expand All @@ -32,3 +33,10 @@ body:
description: Provide a comprehensive description of the problem you're facing. Don't forget to attach any additional resources you may have, such as log files and screenshots.
validations:
required: true
- type: textarea
id: log
attributes:
label: Bloxstrap Log
description: If you're getting a Bloxstrap Exception error, upload your log file here. Otherwise, just leave it empty.
value: "N/A"
#render: text
108 changes: 69 additions & 39 deletions Bloxstrap/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ namespace Bloxstrap
public partial class App : Application
{
public const string ProjectName = "Bloxstrap";
public const string ProjectOwner = "pizzaboxer";
public const string ProjectRepository = "pizzaboxer/bloxstrap";
public const string ProjectDownloadLink = "https://bloxstraplabs.com";
public const string ProjectHelpLink = "https://github.com/pizzaboxer/bloxstrap/wiki";
public const string ProjectSupportLink = "https://github.com/pizzaboxer/bloxstrap/issues/new";

public const string RobloxPlayerAppName = "RobloxPlayerBeta";
public const string RobloxStudioAppName = "RobloxStudioBeta";
Expand All @@ -29,9 +33,11 @@ public partial class App : Application

public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];

public static readonly MD5 MD5Provider = MD5.Create();
public static bool IsActionBuild => !String.IsNullOrEmpty(BuildMetadata.CommitRef);

public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);

public static NotifyIconWrapper? NotifyIcon { get; set; }
public static readonly MD5 MD5Provider = MD5.Create();

public static readonly Logger Logger = new();

Expand All @@ -49,18 +55,14 @@ public partial class App : Application
)
);

#if RELEASE
private static bool _showingExceptionDialog = false;
#endif


public static void Terminate(ErrorCode exitCode = ErrorCode.ERROR_SUCCESS)
{
int exitCodeNum = (int)exitCode;

Logger.WriteLine("App::Terminate", $"Terminating with exit code {exitCodeNum} ({exitCode})");

NotifyIcon?.Dispose();

Environment.Exit(exitCodeNum);
}

Expand All @@ -73,24 +75,51 @@ void GlobalExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs
FinalizeExceptionHandling(e.Exception);
}

public static void FinalizeExceptionHandling(Exception exception, bool log = true)
public static void FinalizeExceptionHandling(AggregateException ex)
{
foreach (var innerEx in ex.InnerExceptions)
Logger.WriteException("App::FinalizeExceptionHandling", innerEx);

FinalizeExceptionHandling(ex.GetBaseException(), false);
}

public static void FinalizeExceptionHandling(Exception ex, bool log = true)
{
if (log)
Logger.WriteException("App::FinalizeExceptionHandling", exception);
Logger.WriteException("App::FinalizeExceptionHandling", ex);

#if DEBUG
throw exception;
#else
if (_showingExceptionDialog)
return;

_showingExceptionDialog = true;

if (!LaunchSettings.QuietFlag.Active)
Frontend.ShowExceptionDialog(exception);
Frontend.ShowExceptionDialog(ex);

Terminate(ErrorCode.ERROR_INSTALL_FAILURE);
#endif
}

public static async Task<GithubRelease?> GetLatestRelease()
{
const string LOG_IDENT = "App::GetLatestRelease";

try
{
var releaseInfo = await Http.GetJson<GithubRelease>($"https://api.github.com/repos/{ProjectRepository}/releases/latest");

if (releaseInfo is null || releaseInfo.Assets is null)
{
Logger.WriteLine(LOG_IDENT, "Encountered invalid data");
return null;
}

return releaseInfo;
}
catch (Exception ex)
{
Logger.WriteException(LOG_IDENT, ex);
}

return null;
}

protected override void OnStartup(StartupEventArgs e)
Expand All @@ -103,10 +132,10 @@ protected override void OnStartup(StartupEventArgs e)

Logger.WriteLine(LOG_IDENT, $"Starting {ProjectName} v{Version}");

if (String.IsNullOrEmpty(BuildMetadata.CommitHash))
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from {BuildMetadata.Machine}");
else
if (IsActionBuild)
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from commit {BuildMetadata.CommitHash} ({BuildMetadata.CommitRef})");
else
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from {BuildMetadata.Machine}");

Logger.WriteLine(LOG_IDENT, $"Loaded from {Paths.Process}");

Expand Down Expand Up @@ -162,28 +191,33 @@ protected override void OnStartup(StartupEventArgs e)
}
}

if (fixInstallLocation && installLocation is not null)
{
var installer = new Installer
{
InstallLocation = installLocation,
IsImplicitInstall = true
};

if (installer.CheckInstallLocation())
{
Logger.WriteLine(LOG_IDENT, $"Changing install location to '{installLocation}'");
installer.DoInstall();
}
else
{
// force reinstall
installLocation = null;
}
}

if (installLocation is null)
{
Logger.Initialize(true);
LaunchHandler.LaunchInstaller();
}
else
{
if (fixInstallLocation)
{
var installer = new Installer
{
InstallLocation = installLocation,
IsImplicitInstall = true
};

if (installer.CheckInstallLocation())
{
Logger.WriteLine(LOG_IDENT, $"Changing install location to '{installLocation}'");
installer.DoInstall();
}
}

Paths.Initialize(installLocation);

// ensure executable is in the install directory
Expand All @@ -202,10 +236,6 @@ protected override void OnStartup(StartupEventArgs e)
State.Load();
FastFlags.Load();

// we can only parse them now as settings need
// to be loaded first to know what our channel is
// LaunchSettings.ParseRoblox();

if (!Locale.SupportedLocales.ContainsKey(Settings.Prop.Locale))
{
Settings.Prop.Locale = "nil";
Expand All @@ -214,13 +244,13 @@ protected override void OnStartup(StartupEventArgs e)

Locale.Set(Settings.Prop.Locale);

if (!LaunchSettings.UninstallFlag.Active)
if (!LaunchSettings.BypassUpdateCheck)
Installer.HandleUpgrade();

LaunchHandler.ProcessLaunchArgs();
}

Terminate();
// you must *explicitly* call terminate when everything is done, it won't be called implicitly
}
}
}
9 changes: 9 additions & 0 deletions Bloxstrap/AppData/CommonAppData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ public abstract class CommonAppData
{ "extracontent-places.zip", @"ExtraContent\places\" },
};

public virtual string ExecutableName { get; } = null!;

public virtual string Directory { get; } = null!;

public string LockFilePath => Path.Combine(Directory, "Bloxstrap.lock");

public string ExecutablePath => Path.Combine(Directory, ExecutableName);

public virtual IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; }


public CommonAppData()
{
if (PackageDirectoryMap is null)
Expand Down
16 changes: 9 additions & 7 deletions Bloxstrap/AppData/IAppData.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bloxstrap.AppData
namespace Bloxstrap.AppData
{
internal interface IAppData
{
Expand All @@ -18,6 +12,14 @@ internal interface IAppData

string StartEvent { get; }

string Directory { get; }

string LockFilePath { get; }

string ExecutablePath { get; }

AppState State { get; }

IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; }
}
}
14 changes: 9 additions & 5 deletions Bloxstrap/AppData/RobloxPlayerData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ namespace Bloxstrap.AppData
{
public class RobloxPlayerData : CommonAppData, IAppData
{
public string ProductName { get; } = "Roblox";
public string ProductName => "Roblox";

public string BinaryType { get; } = "WindowsPlayer";
public string BinaryType => "WindowsPlayer";

public string RegistryName { get; } = "RobloxPlayer";
public string RegistryName => "RobloxPlayer";

public string ExecutableName { get; } = "RobloxPlayerBeta.exe";
public override string ExecutableName => "RobloxPlayerBeta.exe";

public string StartEvent { get; } = "www.roblox.com/robloxStartedEvent";
public string StartEvent => "www.roblox.com/robloxStartedEvent";

public override string Directory => Path.Combine(Paths.Roblox, "Player");

public AppState State => App.State.Prop.Player;

public override IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; } = new Dictionary<string, string>()
{
Expand Down
22 changes: 10 additions & 12 deletions Bloxstrap/AppData/RobloxStudioData.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bloxstrap.AppData
namespace Bloxstrap.AppData
{
public class RobloxStudioData : CommonAppData, IAppData
{
public string ProductName { get; } = "Roblox Studio";
public string ProductName => "Roblox Studio";

public string BinaryType => "WindowsStudio64";

public string BinaryType { get; } = "WindowsStudio64";
public string RegistryName => "RobloxStudio";

public string RegistryName { get; } = "RobloxStudio";
public override string ExecutableName => "RobloxStudioBeta.exe";

public string ExecutableName { get; } = "RobloxStudioBeta.exe";
public string StartEvent => "www.roblox.com/robloxStudioStartedEvent";

public string StartEvent { get; } = "www.roblox.com/robloxStudioStartedEvent";
public override string Directory => Path.Combine(Paths.Roblox, "Studio");

public AppState State => App.State.Prop.Studio;

public override IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; } = new Dictionary<string, string>()
{
Expand Down
Loading

0 comments on commit 89fef19

Please sign in to comment.