Merge pull request #74 from pizzaboxer/wpf-migration

Migrate project base from WinForms to WPF
This commit is contained in:
pizzaboxer 2023-01-27 20:10:07 +00:00 committed by GitHub
commit 695384fffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 391 additions and 381 deletions

View File

@ -1,9 +1,9 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148 VisualStudioVersion = 17.3.32819.101
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bloxstrap", "Bloxstrap\Bloxstrap.csproj", "{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bloxstrap", "Bloxstrap\Bloxstrap.csproj", "{0D75146E-DA24-4B05-B6C9-250C8F81B0C7}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.Debug|Any CPU.Build.0 = Debug|Any CPU {0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.Release|Any CPU.ActiveCfg = Release|Any CPU {0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.Release|Any CPU.Build.0 = Release|Any CPU {0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F989AC04-B48F-4BB4-B940-1E7D082F14DA} SolutionGuid = {ED269E5D-8C72-49B4-A76F-51CF163511C1}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

13
Bloxstrap/App.xaml Normal file
View File

@ -0,0 +1,13 @@
<Application x:Class="Bloxstrap.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Bloxstrap">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="Themes\ColourfulDarkTheme.xaml" />-->
<ResourceDictionary Source="Dialogs\Menu\Themes\LightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -1,21 +1,25 @@
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Windows;
using Microsoft.Win32; using Microsoft.Win32;
using Bloxstrap.Enums;
using Bloxstrap.Helpers;
using Bloxstrap.Models; using Bloxstrap.Models;
using Bloxstrap.Dialogs.Menu; using Bloxstrap.Dialogs.Menu;
using Bloxstrap.Enums;
using Bloxstrap.Helpers;
namespace Bloxstrap namespace Bloxstrap
{ {
internal static class Program /// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{ {
public const StringComparison StringFormat = StringComparison.InvariantCulture; public const StringComparison StringFormat = StringComparison.InvariantCulture;
public static readonly CultureInfo CultureFormat = CultureInfo.InvariantCulture; public static readonly CultureInfo CultureFormat = CultureInfo.InvariantCulture;
@ -39,47 +43,45 @@ namespace Bloxstrap
public static readonly HttpClient HttpClient = new(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All }); public static readonly HttpClient HttpClient = new(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All });
// shorthand // shorthand
public static DialogResult ShowMessageBox(string message, MessageBoxIcon icon = MessageBoxIcon.None, MessageBoxButtons buttons = MessageBoxButtons.OK) public static MessageBoxResult ShowMessageBox(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK)
{ {
if (IsQuiet) if (IsQuiet)
return DialogResult.None; return MessageBoxResult.None;
return MessageBox.Show(message, ProjectName, buttons, icon); return MessageBox.Show(message, ProjectName, buttons, icon);
} }
public static void Exit(int code = Bootstrapper.ERROR_SUCCESS) public static void Terminate(int code = Bootstrapper.ERROR_SUCCESS)
{ {
SettingsManager.Save(); SettingsManager.Save();
Environment.Exit(code); Environment.Exit(code);
} }
/// <summary> protected override void OnStartup(StartupEventArgs e)
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{ {
base.OnStartup(e);
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
LaunchArgs = args; LaunchArgs = e.Args;
HttpClient.Timeout = TimeSpan.FromMinutes(5); HttpClient.Timeout = TimeSpan.FromMinutes(5);
HttpClient.DefaultRequestHeaders.Add("User-Agent", ProjectRepository); HttpClient.DefaultRequestHeaders.Add("User-Agent", ProjectRepository);
if (args.Length > 0) if (LaunchArgs.Length > 0)
{ {
if (Array.IndexOf(args, "-quiet") != -1) if (Array.IndexOf(LaunchArgs, "-quiet") != -1)
IsQuiet = true; IsQuiet = true;
if (Array.IndexOf(args, "-uninstall") != -1) if (Array.IndexOf(LaunchArgs, "-uninstall") != -1)
IsUninstall = true; IsUninstall = true;
if (Array.IndexOf(args, "-nolaunch") != -1) if (Array.IndexOf(LaunchArgs, "-nolaunch") != -1)
IsNoLaunch = true; IsNoLaunch = true;
if (Array.IndexOf(args, "-upgrade") != -1) if (Array.IndexOf(LaunchArgs, "-upgrade") != -1)
IsUpgrade = true; IsUpgrade = true;
} }
@ -126,28 +128,28 @@ namespace Bloxstrap
string commandLine = ""; string commandLine = "";
#if false//DEBUG #if DEBUG
new Preferences().ShowDialog(); new Preferences().ShowDialog();
#else #else
if (args.Length > 0) if (LaunchArgs.Length > 0)
{ {
if (args[0] == "-preferences") if (LaunchArgs[0] == "-preferences")
{ {
if (Process.GetProcessesByName(ProjectName).Length > 1) if (Process.GetProcessesByName(ProjectName).Length > 1)
{ {
ShowMessageBox($"{ProjectName} is already running. Please close any currently open Bloxstrap or Roblox window before opening the configuration menu.", MessageBoxIcon.Error); ShowMessageBox($"{ProjectName} is already running. Please close any currently open Bloxstrap or Roblox window before opening the configuration menu.", MessageBoxImage.Error);
return; return;
} }
new Preferences().ShowDialog(); new Preferences().ShowDialog();
} }
else if (args[0].StartsWith("roblox-player:")) else if (LaunchArgs[0].StartsWith("roblox-player:"))
{ {
commandLine = Protocol.ParseUri(args[0]); commandLine = Protocol.ParseUri(LaunchArgs[0]);
} }
else if (args[0].StartsWith("roblox:")) else if (LaunchArgs[0].StartsWith("roblox:"))
{ {
commandLine = $"--app --deeplink {args[0]}"; commandLine = $"--app --deeplink {LaunchArgs[0]}";
} }
else else
{ {

10
Bloxstrap/AssemblyInfo.cs Normal file
View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@ -4,14 +4,11 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings> <UseWindowsForms>True</UseWindowsForms>
<PlatformTarget>AnyCPU</PlatformTarget>
<Platforms>AnyCPU;x86</Platforms>
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon> <ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
<Version>1.7.0</Version> <Version>2.0.0</Version>
<FileVersion>1.7.0.0</FileVersion> <FileVersion>2.0.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -30,32 +27,4 @@
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" /> <PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Dialogs\BootstrapperDialogs\LegacyDialog2009.cs" />
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -1,18 +1,21 @@
using System.Diagnostics; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows;
using Microsoft.Win32; using Microsoft.Win32;
using Bloxstrap.Enums;
using Bloxstrap.Dialogs.BootstrapperDialogs; using Bloxstrap.Dialogs.BootstrapperDialogs;
using Bloxstrap.Helpers; using Bloxstrap.Helpers;
using Bloxstrap.Helpers.Integrations; using Bloxstrap.Helpers.Integrations;
using Bloxstrap.Helpers.RSMM; using Bloxstrap.Helpers.RSMM;
using Bloxstrap.Models; using Bloxstrap.Models;
using System.Net;
using Bloxstrap.Properties;
namespace Bloxstrap namespace Bloxstrap
{ {
@ -82,23 +85,20 @@ namespace Bloxstrap
public Bootstrapper(string? launchCommandLine = null) public Bootstrapper(string? launchCommandLine = null)
{ {
LaunchCommandLine = launchCommandLine; LaunchCommandLine = launchCommandLine;
FreshInstall = String.IsNullOrEmpty(Program.Settings.VersionGuid); FreshInstall = String.IsNullOrEmpty(App.Settings.VersionGuid);
} }
// this is called from BootstrapperStyleForm.SetupDialog() // this is called from BootstrapperStyleForm.SetupDialog()
public async Task Run() public async Task Run()
{ {
if (Program.IsQuiet) if (App.IsUninstall)
Dialog.CloseDialog();
if (Program.IsUninstall)
{ {
Uninstall(); Uninstall();
return; return;
} }
#if !DEBUG #if !DEBUG
if (!Program.IsFirstRun && Program.Settings.CheckForUpdates) if (!App.IsFirstRun && App.Settings.CheckForUpdates)
await CheckForUpdates(); await CheckForUpdates();
#endif #endif
@ -106,39 +106,39 @@ namespace Bloxstrap
// if bloxstrap is installing for the first time but is running, prompt to close roblox // if bloxstrap is installing for the first time but is running, prompt to close roblox
// if roblox needs updating but is running, ignore update for now // if roblox needs updating but is running, ignore update for now
if (!Directory.Exists(VersionFolder) && CheckIfRunning(true) || Program.Settings.VersionGuid != VersionGuid && !CheckIfRunning(false)) if (!Directory.Exists(VersionFolder) && CheckIfRunning(true) || App.Settings.VersionGuid != VersionGuid && !CheckIfRunning(false))
await InstallLatestVersion(); await InstallLatestVersion();
await ApplyModifications(); await ApplyModifications();
if (Program.IsFirstRun) if (App.IsFirstRun)
Program.SettingsManager.ShouldSave = true; App.SettingsManager.ShouldSave = true;
if (Program.IsFirstRun || FreshInstall) if (App.IsFirstRun || FreshInstall)
Register(); Register();
CheckInstall(); CheckInstall();
await RbxFpsUnlocker.CheckInstall(); await RbxFpsUnlocker.CheckInstall();
Program.SettingsManager.Save(); App.SettingsManager.Save();
if (Program.IsFirstRun && Program.IsNoLaunch) if (App.IsFirstRun && App.IsNoLaunch)
Dialog.ShowSuccess($"{Program.ProjectName} has successfully installed"); Dialog.ShowSuccess($"{App.ProjectName} has successfully installed");
else if (!Program.IsNoLaunch) else if (!App.IsNoLaunch)
await StartRoblox(); await StartRoblox();
} }
private async Task CheckForUpdates() private async Task CheckForUpdates()
{ {
string currentVersion = $"Bloxstrap v{Program.Version}"; string currentVersion = $"{App.ProjectName} v{App.Version}";
var releaseInfo = await Utilities.GetJson<GithubRelease>($"https://api.github.com/repos/{Program.ProjectRepository}/releases/latest"); var releaseInfo = await Utilities.GetJson<GithubRelease>($"https://api.github.com/repos/{App.ProjectRepository}/releases/latest");
if (releaseInfo is null || releaseInfo.Name is null || releaseInfo.Assets is null || currentVersion == releaseInfo.Name) if (releaseInfo is null || releaseInfo.Name is null || releaseInfo.Assets is null || currentVersion == releaseInfo.Name)
return; return;
Dialog.Message = "Getting the latest Bloxstrap..."; Dialog.Message = $"Getting the latest {App.ProjectName}...";
// 64-bit is always the first option // 64-bit is always the first option
GithubReleaseAsset asset = releaseInfo.Assets[Environment.Is64BitOperatingSystem ? 0 : 1]; GithubReleaseAsset asset = releaseInfo.Assets[Environment.Is64BitOperatingSystem ? 0 : 1];
@ -150,7 +150,7 @@ namespace Bloxstrap
if (!File.Exists(downloadLocation)) if (!File.Exists(downloadLocation))
{ {
var response = await Program.HttpClient.GetAsync(asset.BrowserDownloadUrl); var response = await App.HttpClient.GetAsync(asset.BrowserDownloadUrl);
using (var fileStream = new FileStream(Path.Combine(Directories.Updates, asset.Name), FileMode.CreateNew)) using (var fileStream = new FileStream(Path.Combine(Directories.Updates, asset.Name), FileMode.CreateNew))
{ {
@ -165,10 +165,10 @@ namespace Bloxstrap
FileName = downloadLocation, FileName = downloadLocation,
}; };
foreach (string arg in Program.LaunchArgs) foreach (string arg in App.LaunchArgs)
startInfo.ArgumentList.Add(arg); startInfo.ArgumentList.Add(arg);
Program.SettingsManager.Save(); App.SettingsManager.Save();
Process.Start(startInfo); Process.Start(startInfo);
@ -179,7 +179,7 @@ namespace Bloxstrap
{ {
Dialog.Message = "Connecting to Roblox..."; Dialog.Message = "Connecting to Roblox...";
ClientVersion clientVersion = await DeployManager.GetLastDeploy(Program.Settings.Channel); ClientVersion clientVersion = await DeployManager.GetLastDeploy(App.Settings.Channel);
VersionGuid = clientVersion.VersionGuid; VersionGuid = clientVersion.VersionGuid;
VersionFolder = Path.Combine(Directories.Versions, VersionGuid); VersionFolder = Path.Combine(Directories.Versions, VersionGuid);
VersionPackageManifest = await PackageManifest.Get(VersionGuid); VersionPackageManifest = await PackageManifest.Get(VersionGuid);
@ -214,11 +214,11 @@ namespace Bloxstrap
private async Task StartRoblox() private async Task StartRoblox()
{ {
string startEventName = Program.ProjectName.Replace(" ", "") + "StartEvent"; string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
Dialog.Message = "Starting Roblox..."; Dialog.Message = "Starting Roblox...";
if (LaunchCommandLine == "--app" && Program.Settings.UseDisableAppPatch) if (LaunchCommandLine == "--app" && App.Settings.UseDisableAppPatch)
{ {
Utilities.OpenWebsite("https://www.roblox.com/games"); Utilities.OpenWebsite("https://www.roblox.com/games");
return; return;
@ -227,8 +227,8 @@ namespace Bloxstrap
// launch time isn't really required for all launches, but it's usually just safest to do this // launch time isn't really required for all launches, but it's usually just safest to do this
LaunchCommandLine += " --launchtime=" + DateTimeOffset.Now.ToUnixTimeMilliseconds(); LaunchCommandLine += " --launchtime=" + DateTimeOffset.Now.ToUnixTimeMilliseconds();
if (Program.Settings.Channel.ToLower() != DeployManager.DefaultChannel.ToLower()) if (App.Settings.Channel.ToLower() != DeployManager.DefaultChannel.ToLower())
LaunchCommandLine += " -channel " + Program.Settings.Channel.ToLower(); LaunchCommandLine += " -channel " + App.Settings.Channel.ToLower();
LaunchCommandLine += " -startEvent " + startEventName; LaunchCommandLine += " -startEvent " + startEventName;
@ -247,7 +247,7 @@ namespace Bloxstrap
if (!startEventFired) if (!startEventFired)
return; return;
if (Program.Settings.RFUEnabled && Process.GetProcessesByName("rbxfpsunlocker").Length == 0) if (App.Settings.RFUEnabled && Process.GetProcessesByName("rbxfpsunlocker").Length == 0)
{ {
ProcessStartInfo startInfo = new() ProcessStartInfo startInfo = new()
{ {
@ -257,7 +257,7 @@ namespace Bloxstrap
rbxFpsUnlocker = Process.Start(startInfo); rbxFpsUnlocker = Process.Start(startInfo);
if (Program.Settings.RFUAutoclose) if (App.Settings.RFUAutoclose)
shouldWait = true; shouldWait = true;
} }
@ -265,7 +265,7 @@ namespace Bloxstrap
await Task.Delay(3000); await Task.Delay(3000);
// now we move onto handling rich presence // now we move onto handling rich presence
if (Program.Settings.UseDiscordRichPresence) if (App.Settings.UseDiscordRichPresence)
{ {
richPresence = new DiscordRichPresence(); richPresence = new DiscordRichPresence();
richPresence.MonitorGameActivity(); richPresence.MonitorGameActivity();
@ -283,7 +283,7 @@ namespace Bloxstrap
if (richPresence is not null) if (richPresence is not null)
richPresence.Dispose(); richPresence.Dispose();
if (Program.Settings.RFUAutoclose && rbxFpsUnlocker is not null) if (App.Settings.RFUAutoclose && rbxFpsUnlocker is not null)
rbxFpsUnlocker.Kill(); rbxFpsUnlocker.Kill();
} }
} }
@ -292,7 +292,7 @@ namespace Bloxstrap
{ {
if (!Dialog.CancelEnabled) if (!Dialog.CancelEnabled)
{ {
Program.Exit(ERROR_INSTALL_USEREXIT); App.Terminate(ERROR_INSTALL_USEREXIT);
return; return;
} }
@ -300,21 +300,21 @@ namespace Bloxstrap
try try
{ {
if (Program.IsFirstRun) if (App.IsFirstRun)
Directory.Delete(Directories.Base, true); Directory.Delete(Directories.Base, true);
else if (Directory.Exists(VersionFolder)) else if (Directory.Exists(VersionFolder))
Directory.Delete(VersionFolder, true); Directory.Delete(VersionFolder, true);
} }
catch (Exception) { } catch (Exception) { }
Program.Exit(ERROR_INSTALL_USEREXIT); App.Terminate(ERROR_INSTALL_USEREXIT);
} }
#endregion #endregion
#region App Install #region App Install
public static void Register() public static void Register()
{ {
RegistryKey applicationKey = Registry.CurrentUser.CreateSubKey($@"Software\{Program.ProjectName}"); RegistryKey applicationKey = Registry.CurrentUser.CreateSubKey($@"Software\{App.ProjectName}");
// new install location selected, delete old one // new install location selected, delete old one
string? oldInstallLocation = (string?)applicationKey.GetValue("OldInstallLocation"); string? oldInstallLocation = (string?)applicationKey.GetValue("OldInstallLocation");
@ -334,10 +334,10 @@ namespace Bloxstrap
applicationKey.Close(); applicationKey.Close();
// set uninstall key // set uninstall key
RegistryKey uninstallKey = Registry.CurrentUser.CreateSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{Program.ProjectName}"); RegistryKey uninstallKey = Registry.CurrentUser.CreateSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{App.ProjectName}");
uninstallKey.SetValue("DisplayIcon", $"{Directories.App},0"); uninstallKey.SetValue("DisplayIcon", $"{Directories.Application},0");
uninstallKey.SetValue("DisplayName", Program.ProjectName); uninstallKey.SetValue("DisplayName", App.ProjectName);
uninstallKey.SetValue("DisplayVersion", Program.Version); uninstallKey.SetValue("DisplayVersion", App.Version);
if (uninstallKey.GetValue("InstallDate") is null) if (uninstallKey.GetValue("InstallDate") is null)
uninstallKey.SetValue("InstallDate", DateTime.Now.ToString("yyyyMMdd")); uninstallKey.SetValue("InstallDate", DateTime.Now.ToString("yyyyMMdd"));
@ -345,11 +345,11 @@ namespace Bloxstrap
uninstallKey.SetValue("InstallLocation", Directories.Base); uninstallKey.SetValue("InstallLocation", Directories.Base);
uninstallKey.SetValue("NoRepair", 1); uninstallKey.SetValue("NoRepair", 1);
uninstallKey.SetValue("Publisher", "pizzaboxer"); uninstallKey.SetValue("Publisher", "pizzaboxer");
uninstallKey.SetValue("ModifyPath", $"\"{Directories.App}\" -preferences"); uninstallKey.SetValue("ModifyPath", $"\"{Directories.Application}\" -preferences");
uninstallKey.SetValue("QuietUninstallString", $"\"{Directories.App}\" -uninstall -quiet"); uninstallKey.SetValue("QuietUninstallString", $"\"{Directories.Application}\" -uninstall -quiet");
uninstallKey.SetValue("UninstallString", $"\"{Directories.App}\" -uninstall"); uninstallKey.SetValue("UninstallString", $"\"{Directories.Application}\" -uninstall");
uninstallKey.SetValue("URLInfoAbout", $"https://github.com/{Program.ProjectRepository}"); uninstallKey.SetValue("URLInfoAbout", $"https://github.com/{App.ProjectRepository}");
uninstallKey.SetValue("URLUpdateInfo", $"https://github.com/{Program.ProjectRepository}/releases/latest"); uninstallKey.SetValue("URLUpdateInfo", $"https://github.com/{App.ProjectRepository}/releases/latest");
uninstallKey.Close(); uninstallKey.Close();
} }
@ -359,16 +359,16 @@ namespace Bloxstrap
// this doesn't go under register, so we check every launch // this doesn't go under register, so we check every launch
// just in case the stock bootstrapper changes it back // just in case the stock bootstrapper changes it back
Protocol.Register("roblox", "Roblox", Directories.App); Protocol.Register("roblox", "Roblox", Directories.Application);
Protocol.Register("roblox-player", "Roblox", Directories.App); Protocol.Register("roblox-player", "Roblox", Directories.Application);
// in case the user is reinstalling // in case the user is reinstalling
if (File.Exists(Directories.App) && Program.IsFirstRun) if (File.Exists(Directories.Application) && App.IsFirstRun)
File.Delete(Directories.App); File.Delete(Directories.Application);
// check to make sure bootstrapper is in the install folder // check to make sure bootstrapper is in the install folder
if (!File.Exists(Directories.App) && Environment.ProcessPath is not null) if (!File.Exists(Directories.Application) && Environment.ProcessPath is not null)
File.Copy(Environment.ProcessPath, Directories.App); File.Copy(Environment.ProcessPath, Directories.Application);
// this SHOULD go under Register(), // this SHOULD go under Register(),
// but then people who have Bloxstrap v1.0.0 installed won't have this without a reinstall // but then people who have Bloxstrap v1.0.0 installed won't have this without a reinstall
@ -377,16 +377,16 @@ namespace Bloxstrap
{ {
Directory.CreateDirectory(Directories.StartMenu); Directory.CreateDirectory(Directories.StartMenu);
ShellLink.Shortcut.CreateShortcut(Directories.App, "", Directories.App, 0) ShellLink.Shortcut.CreateShortcut(Directories.Application, "", Directories.Application, 0)
.WriteToFile(Path.Combine(Directories.StartMenu, "Play Roblox.lnk")); .WriteToFile(Path.Combine(Directories.StartMenu, "Play Roblox.lnk"));
ShellLink.Shortcut.CreateShortcut(Directories.App, "-preferences", Directories.App, 0) ShellLink.Shortcut.CreateShortcut(Directories.Application, "-preferences", Directories.Application, 0)
.WriteToFile(Path.Combine(Directories.StartMenu, $"Configure {Program.ProjectName}.lnk")); .WriteToFile(Path.Combine(Directories.StartMenu, $"Configure {App.ProjectName}.lnk"));
} }
if (Program.Settings.CreateDesktopIcon && !File.Exists(Path.Combine(Directories.Desktop, "Play Roblox.lnk"))) if (App.Settings.CreateDesktopIcon && !File.Exists(Path.Combine(Directories.Desktop, "Play Roblox.lnk")))
{ {
ShellLink.Shortcut.CreateShortcut(Directories.App, "", Directories.App, 0) ShellLink.Shortcut.CreateShortcut(Directories.Application, "", Directories.Application, 0)
.WriteToFile(Path.Combine(Directories.Desktop, "Play Roblox.lnk")); .WriteToFile(Path.Combine(Directories.Desktop, "Play Roblox.lnk"));
} }
} }
@ -395,9 +395,9 @@ namespace Bloxstrap
{ {
CheckIfRunning(true); CheckIfRunning(true);
Dialog.Message = $"Uninstalling {Program.ProjectName}..."; Dialog.Message = $"Uninstalling {App.ProjectName}...";
Program.SettingsManager.ShouldSave = false; App.SettingsManager.ShouldSave = false;
// check if stock bootstrapper is still installed // check if stock bootstrapper is still installed
RegistryKey? bootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-player"); RegistryKey? bootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-player");
@ -419,7 +419,7 @@ namespace Bloxstrap
try try
{ {
// delete application key // delete application key
Registry.CurrentUser.DeleteSubKey($@"Software\{Program.ProjectName}"); Registry.CurrentUser.DeleteSubKey($@"Software\{App.ProjectName}");
// delete start menu folder // delete start menu folder
Directory.Delete(Directories.StartMenu, true); Directory.Delete(Directories.StartMenu, true);
@ -428,7 +428,7 @@ namespace Bloxstrap
File.Delete(Path.Combine(Directories.Desktop, "Play Roblox.lnk")); File.Delete(Path.Combine(Directories.Desktop, "Play Roblox.lnk"));
// delete uninstall key // delete uninstall key
Registry.CurrentUser.DeleteSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{Program.ProjectName}"); Registry.CurrentUser.DeleteSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{App.ProjectName}");
// delete installation folder // delete installation folder
// (should delete everything except bloxstrap itself) // (should delete everything except bloxstrap itself)
@ -439,9 +439,9 @@ namespace Bloxstrap
Debug.WriteLine($"Could not fully uninstall! ({e})"); Debug.WriteLine($"Could not fully uninstall! ({e})");
} }
Dialog.ShowSuccess($"{Program.ProjectName} has succesfully uninstalled"); Dialog.ShowSuccess($"{App.ProjectName} has succesfully uninstalled");
Program.Exit(); App.Terminate();
} }
#endregion #endregion
@ -462,8 +462,8 @@ namespace Bloxstrap
// check if we have at least 300 megabytes of free disk space // check if we have at least 300 megabytes of free disk space
if (Utilities.GetFreeDiskSpace(Directories.Base) < 1024*1024*300) if (Utilities.GetFreeDiskSpace(Directories.Base) < 1024*1024*300)
{ {
Program.ShowMessageBox($"{Program.ProjectName} requires at least 300 MB of disk space to install Roblox. Please free up some disk space and try again.", MessageBoxIcon.Error); App.ShowMessageBox($"{App.ProjectName} requires at least 300 MB of disk space to install Roblox. Please free up some disk space and try again.", MessageBoxImage.Error);
Program.Exit(ERROR_INSTALL_FAILURE); App.Terminate(ERROR_INSTALL_FAILURE);
return; return;
} }
@ -518,9 +518,9 @@ namespace Bloxstrap
File.Delete(filename); File.Delete(filename);
} }
string oldVersionFolder = Path.Combine(Directories.Versions, Program.Settings.VersionGuid); string oldVersionFolder = Path.Combine(Directories.Versions, App.Settings.VersionGuid);
if (VersionGuid != Program.Settings.VersionGuid && Directory.Exists(oldVersionFolder)) if (VersionGuid != App.Settings.VersionGuid && Directory.Exists(oldVersionFolder))
{ {
// and also to delete our old version folder // and also to delete our old version folder
Directory.Delete(oldVersionFolder, true); Directory.Delete(oldVersionFolder, true);
@ -529,7 +529,7 @@ namespace Bloxstrap
Dialog.CancelEnabled = false; Dialog.CancelEnabled = false;
Program.Settings.VersionGuid = VersionGuid; App.Settings.VersionGuid = VersionGuid;
} }
private async Task ApplyModifications() private async Task ApplyModifications()
@ -545,10 +545,10 @@ namespace Bloxstrap
if (!Directory.Exists(modFolder)) if (!Directory.Exists(modFolder))
Directory.CreateDirectory(modFolder); Directory.CreateDirectory(modFolder);
await CheckModPreset(Program.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg"); await CheckModPreset(App.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg");
await CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "OldCursor.png"); await CheckModPreset(App.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "OldCursor.png");
await CheckModPreset(Program.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "OldFarCursor.png"); await CheckModPreset(App.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "OldFarCursor.png");
await CheckModPreset(Program.Settings.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", ""); await CheckModPreset(App.Settings.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
await ReShade.CheckModifications(); await ReShade.CheckModifications();
@ -697,7 +697,7 @@ namespace Bloxstrap
if (CancelFired) if (CancelFired)
return; return;
var response = await Program.HttpClient.GetAsync(packageUrl, HttpCompletionOption.ResponseHeadersRead); var response = await App.HttpClient.GetAsync(packageUrl, HttpCompletionOption.ResponseHeadersRead);
var buffer = new byte[8192]; var buffer = new byte[8192];

View File

@ -1,4 +1,9 @@
using Bloxstrap.Enums; using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using Bloxstrap.Enums;
using Bloxstrap.Helpers; using Bloxstrap.Helpers;
namespace Bloxstrap.Dialogs.BootstrapperDialogs namespace Bloxstrap.Dialogs.BootstrapperDialogs
@ -74,11 +79,8 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
public void SetupDialog() public void SetupDialog()
{ {
if (Program.IsQuiet) this.Text = App.ProjectName;
this.Hide(); this.Icon = App.Settings.BootstrapperIcon.GetIcon();
this.Text = Program.ProjectName;
this.Icon = Program.Settings.BootstrapperIcon.GetIcon();
if (Bootstrapper is null) if (Bootstrapper is null)
{ {
@ -113,19 +115,19 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
} }
#endif #endif
Program.Exit(); App.Terminate();
} }
public virtual void ShowSuccess(string message) public virtual void ShowSuccess(string message)
{ {
Program.ShowMessageBox(message, MessageBoxIcon.Information); App.ShowMessageBox(message, MessageBoxImage.Information);
Program.Exit(); App.Terminate();
} }
public virtual void ShowError(string message) public virtual void ShowError(string message)
{ {
Program.ShowMessageBox($"An error occurred while starting Roblox\n\nDetails: {message}", MessageBoxIcon.Error); App.ShowMessageBox($"An error occurred while starting Roblox\n\nDetails: {message}", MessageBoxImage.Error);
Program.Exit(Bootstrapper.ERROR_INSTALL_FAILURE); App.Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
} }
public virtual void CloseDialog() public virtual void CloseDialog()
@ -138,13 +140,13 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
public void PromptShutdown() public void PromptShutdown()
{ {
DialogResult result = Program.ShowMessageBox( MessageBoxResult result = App.ShowMessageBox(
"Roblox is currently running, but needs to close. Would you like close Roblox now?", "Roblox is currently running, but needs to close. Would you like close Roblox now?",
MessageBoxIcon.Information, MessageBoxImage.Information,
MessageBoxButtons.OKCancel MessageBoxButton.OKCancel
); );
if (result != DialogResult.OK) if (result != MessageBoxResult.OK)
Environment.Exit(Bootstrapper.ERROR_INSTALL_USEREXIT); Environment.Exit(Bootstrapper.ERROR_INSTALL_USEREXIT);
} }

View File

@ -1,4 +1,6 @@
namespace Bloxstrap.Dialogs.BootstrapperDialogs using System.Windows.Forms;
namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
public interface IBootstrapperDialog public interface IBootstrapperDialog
{ {

View File

@ -1,4 +1,6 @@
namespace Bloxstrap.Dialogs.BootstrapperDialogs using System.Windows.Forms;
namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
partial class LegacyDialog2009 partial class LegacyDialog2009
{ {

View File

@ -1,3 +1,6 @@
using System;
using System.Windows.Forms;
namespace Bloxstrap.Dialogs.BootstrapperDialogs namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
// windows: https://youtu.be/VpduiruysuM?t=18 // windows: https://youtu.be/VpduiruysuM?t=18

View File

@ -1,4 +1,6 @@
namespace Bloxstrap.Dialogs.BootstrapperDialogs using System.Windows.Forms;
namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
partial class LegacyDialog2011 partial class LegacyDialog2011
{ {

View File

@ -1,3 +1,6 @@
using System;
using System.Windows.Forms;
using Bloxstrap.Enums; using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.BootstrapperDialogs namespace Bloxstrap.Dialogs.BootstrapperDialogs
@ -37,7 +40,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
Bootstrapper = bootstrapper; Bootstrapper = bootstrapper;
// have to convert icon -> bitmap since winforms scaling is poop // have to convert icon -> bitmap since winforms scaling is poop
this.IconBox.BackgroundImage = Program.Settings.BootstrapperIcon.GetIcon().ToBitmap(); this.IconBox.BackgroundImage = App.Settings.BootstrapperIcon.GetIcon().ToBitmap();
ScaleWindow(); ScaleWindow();
SetupDialog(); SetupDialog();

View File

@ -1,4 +1,6 @@
namespace Bloxstrap.Dialogs.BootstrapperDialogs using System.Windows.Forms;
namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
partial class ProgressDialog partial class ProgressDialog
{ {

View File

@ -1,4 +1,8 @@
using Bloxstrap.Enums; using System;
using System.Drawing;
using System.Windows.Forms;
using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.BootstrapperDialogs namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
@ -34,7 +38,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
InitializeComponent(); InitializeComponent();
if (Program.Settings.Theme.GetFinal() == Theme.Dark) if (App.Settings.Theme.GetFinal() == Theme.Dark)
{ {
this.labelMessage.ForeColor = SystemColors.Window; this.labelMessage.ForeColor = SystemColors.Window;
this.buttonCancel.Image = Properties.Resources.DarkCancelButton; this.buttonCancel.Image = Properties.Resources.DarkCancelButton;
@ -44,14 +48,14 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
Bootstrapper = bootstrapper; Bootstrapper = bootstrapper;
this.IconBox.BackgroundImage = Program.Settings.BootstrapperIcon.GetBitmap(); this.IconBox.BackgroundImage = App.Settings.BootstrapperIcon.GetBitmap();
SetupDialog(); SetupDialog();
} }
private void ButtonCancel_MouseEnter(object sender, EventArgs e) private void ButtonCancel_MouseEnter(object sender, EventArgs e)
{ {
if (Program.Settings.Theme.GetFinal() == Theme.Dark) if (App.Settings.Theme.GetFinal() == Theme.Dark)
{ {
this.buttonCancel.Image = Properties.Resources.DarkCancelButtonHover; this.buttonCancel.Image = Properties.Resources.DarkCancelButtonHover;
} }
@ -63,7 +67,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
private void ButtonCancel_MouseLeave(object sender, EventArgs e) private void ButtonCancel_MouseLeave(object sender, EventArgs e)
{ {
if (Program.Settings.Theme.GetFinal() == Theme.Dark) if (App.Settings.Theme.GetFinal() == Theme.Dark)
{ {
this.buttonCancel.Image = Properties.Resources.DarkCancelButton; this.buttonCancel.Image = Properties.Resources.DarkCancelButton;
} }

View File

@ -1,4 +1,7 @@
using Bloxstrap.Enums; using System;
using System.Windows.Forms;
using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.BootstrapperDialogs namespace Bloxstrap.Dialogs.BootstrapperDialogs
{ {
@ -65,8 +68,8 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
Dialog = new TaskDialogPage() Dialog = new TaskDialogPage()
{ {
Icon = new TaskDialogIcon(Program.Settings.BootstrapperIcon.GetIcon()), Icon = new TaskDialogIcon(App.Settings.BootstrapperIcon.GetIcon()),
Caption = Program.ProjectName, Caption = App.ProjectName,
Buttons = { TaskDialogButton.Cancel }, Buttons = { TaskDialogButton.Cancel },
ProgressBar = new TaskDialogProgressBar() ProgressBar = new TaskDialogProgressBar()
@ -94,14 +97,14 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
TaskDialogPage successDialog = new() TaskDialogPage successDialog = new()
{ {
Icon = TaskDialogIcon.ShieldSuccessGreenBar, Icon = TaskDialogIcon.ShieldSuccessGreenBar,
Caption = Program.ProjectName, Caption = App.ProjectName,
Heading = message, Heading = message,
Buttons = { TaskDialogButton.OK } Buttons = { TaskDialogButton.OK }
}; };
successDialog.Buttons[0].Click += (sender, e) => Program.Exit(); successDialog.Buttons[0].Click += (sender, e) => App.Terminate();
if (!Program.IsQuiet) if (!App.IsQuiet)
Dialog.Navigate(successDialog); Dialog.Navigate(successDialog);
Dialog = successDialog; Dialog = successDialog;
@ -119,7 +122,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
TaskDialogPage errorDialog = new() TaskDialogPage errorDialog = new()
{ {
Icon = TaskDialogIcon.Error, Icon = TaskDialogIcon.Error,
Caption = Program.ProjectName, Caption = App.ProjectName,
Heading = "An error occurred while starting Roblox", Heading = "An error occurred while starting Roblox",
Buttons = { TaskDialogButton.Close }, Buttons = { TaskDialogButton.Close },
Expander = new TaskDialogExpander() Expander = new TaskDialogExpander()
@ -131,9 +134,9 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
} }
}; };
errorDialog.Buttons[0].Click += (sender, e) => Program.Exit(Bootstrapper.ERROR_INSTALL_FAILURE); errorDialog.Buttons[0].Click += (sender, e) => App.Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
if (!Program.IsQuiet) if (!App.IsQuiet)
Dialog.Navigate(errorDialog); Dialog.Navigate(errorDialog);
Dialog = errorDialog; Dialog = errorDialog;
@ -158,7 +161,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
private void VistaDialog_Load(object sender, EventArgs e) private void VistaDialog_Load(object sender, EventArgs e)
{ {
if (!Program.IsQuiet) if (!App.IsQuiet)
TaskDialog.ShowDialog(Dialog); TaskDialog.ShowDialog(Dialog);
} }
} }

View File

@ -10,14 +10,6 @@
SizeToContent="WidthAndHeight" SizeToContent="WidthAndHeight"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"> WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="Themes\ColourfulDarkTheme.xaml" />-->
<ResourceDictionary Source="Themes\LightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Width="420" Height="260"> <Grid Width="420" Height="260">
<StackPanel Margin="10"> <StackPanel Margin="10">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Modification Help" VerticalAlignment="Top" FontSize="18" /> <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Modification Help" VerticalAlignment="Top" FontSize="18" />

View File

@ -1,6 +1,5 @@
using System.Windows; using System;
using System.Windows;
using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.Menu namespace Bloxstrap.Dialogs.Menu
{ {
@ -12,17 +11,6 @@ namespace Bloxstrap.Dialogs.Menu
public ModHelp() public ModHelp()
{ {
InitializeComponent(); InitializeComponent();
SetTheme();
}
public void SetTheme()
{
string theme = "Light";
if (Program.Settings.Theme.GetFinal() == Theme.Dark)
theme = "ColourfulDark";
this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) };
} }
private void ButtonClose_Click(object sender, EventArgs e) private void ButtonClose_Click(object sender, EventArgs e)

View File

@ -10,14 +10,6 @@
SizeToContent="WidthAndHeight" SizeToContent="WidthAndHeight"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"> WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="Themes\ColourfulDarkTheme.xaml" />-->
<ResourceDictionary Source="Themes\LightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Width="480" Height="360"> <Grid Width="480" Height="360">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Configure Bloxstrap" VerticalAlignment="Top" FontSize="18"/> <TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Configure Bloxstrap" VerticalAlignment="Top" FontSize="18"/>
<TextBlock HorizontalAlignment="Right" Margin="0,14,10,0" TextWrapping="Wrap" Text="{Binding BloxstrapVersion, Mode=OneTime}" VerticalAlignment="Top" FontSize="12"/> <TextBlock HorizontalAlignment="Right" Margin="0,14,10,0" TextWrapping="Wrap" Text="{Binding BloxstrapVersion, Mode=OneTime}" VerticalAlignment="Top" FontSize="12"/>

View File

@ -1,7 +1,11 @@
using System.ComponentModel; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
@ -29,7 +33,7 @@ namespace Bloxstrap.Dialogs.Menu
ViewModel = new(this); ViewModel = new(this);
this.DataContext = ViewModel; this.DataContext = ViewModel;
Program.SettingsManager.ShouldSave = false; App.SettingsManager.ShouldSave = false;
this.Icon = Imaging.CreateBitmapSourceFromHIcon( this.Icon = Imaging.CreateBitmapSourceFromHIcon(
Properties.Resources.IconBloxstrap_ico.Handle, Properties.Resources.IconBloxstrap_ico.Handle,
@ -37,7 +41,7 @@ namespace Bloxstrap.Dialogs.Menu
BitmapSizeOptions.FromEmptyOptions() BitmapSizeOptions.FromEmptyOptions()
); );
this.Title = Program.ProjectName; this.Title = App.ProjectName;
// just in case i guess? // just in case i guess?
if (!Environment.Is64BitOperatingSystem) if (!Environment.Is64BitOperatingSystem)
@ -48,10 +52,10 @@ namespace Bloxstrap.Dialogs.Menu
{ {
string theme = "Light"; string theme = "Light";
if (Program.Settings.Theme.GetFinal() == Theme.Dark) if (App.Settings.Theme.GetFinal() == Theme.Dark)
theme = "ColourfulDark"; theme = "ColourfulDark";
this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) }; Application.Current.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) };
} }
private void ButtonOpenReShadeFolder_Click(object sender, EventArgs e) private void ButtonOpenReShadeFolder_Click(object sender, EventArgs e)
@ -76,11 +80,9 @@ namespace Bloxstrap.Dialogs.Menu
private void ButtonLocationBrowse_Click(object sender, EventArgs e) private void ButtonLocationBrowse_Click(object sender, EventArgs e)
{ {
using (var dialog = new FolderBrowserDialog()) using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
{ {
DialogResult result = dialog.ShowDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (result == System.Windows.Forms.DialogResult.OK)
ViewModel.InstallLocation = dialog.SelectedPath; ViewModel.InstallLocation = dialog.SelectedPath;
} }
} }
@ -88,7 +90,7 @@ namespace Bloxstrap.Dialogs.Menu
private void ButtonPreview_Click(object sender, EventArgs e) private void ButtonPreview_Click(object sender, EventArgs e)
{ {
//this.Visible = false; //this.Visible = false;
Program.Settings.BootstrapperStyle.Show(); App.Settings.BootstrapperStyle.Show();
//this.Visible = true; //this.Visible = true;
} }
@ -103,7 +105,7 @@ namespace Bloxstrap.Dialogs.Menu
if (String.IsNullOrEmpty(installLocation)) if (String.IsNullOrEmpty(installLocation))
{ {
Program.ShowMessageBox("You must set an install location", MessageBoxIcon.Error); App.ShowMessageBox("You must set an install location", MessageBoxImage.Error);
return; return;
} }
@ -126,42 +128,42 @@ namespace Bloxstrap.Dialogs.Menu
} }
catch (UnauthorizedAccessException) catch (UnauthorizedAccessException)
{ {
Program.ShowMessageBox($"{Program.ProjectName} does not have write access to the install location you selected. Please choose another install location.", MessageBoxIcon.Error); App.ShowMessageBox($"{App.ProjectName} does not have write access to the install location you selected. Please choose another install location.", MessageBoxImage.Error);
return; return;
} }
catch (Exception ex) catch (Exception ex)
{ {
Program.ShowMessageBox(ex.Message, MessageBoxIcon.Error); App.ShowMessageBox(ex.Message, MessageBoxImage.Error);
return; return;
} }
if (Program.IsFirstRun) if (App.IsFirstRun)
{ {
// this will be set in the registry after first install // this will be set in the registry after first install
Program.BaseDirectory = installLocation; App.BaseDirectory = installLocation;
} }
else else
{ {
Program.SettingsManager.ShouldSave = true; App.SettingsManager.ShouldSave = true;
if (Program.BaseDirectory is not null && Program.BaseDirectory != installLocation) if (App.BaseDirectory is not null && App.BaseDirectory != installLocation)
{ {
Program.ShowMessageBox($"{Program.ProjectName} will install to the new location you've set the next time it runs.", MessageBoxIcon.Information); App.ShowMessageBox($"{App.ProjectName} will install to the new location you've set the next time it runs.", MessageBoxImage.Information);
Program.Settings.VersionGuid = ""; App.Settings.VersionGuid = "";
using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey($@"Software\{Program.ProjectName}")) using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey($@"Software\{App.ProjectName}"))
{ {
registryKey.SetValue("InstallLocation", installLocation); registryKey.SetValue("InstallLocation", installLocation);
registryKey.SetValue("OldInstallLocation", Program.BaseDirectory); registryKey.SetValue("OldInstallLocation", App.BaseDirectory);
} }
// preserve settings // preserve settings
// we don't need to copy the bootstrapper over since the install process will do that automatically // we don't need to copy the bootstrapper over since the install process will do that automatically
Program.SettingsManager.Save(); App.SettingsManager.Save();
File.Copy(Path.Combine(Program.BaseDirectory, "Settings.json"), Path.Combine(installLocation, "Settings.json")); File.Copy(Path.Combine(App.BaseDirectory, "Settings.json"), Path.Combine(installLocation, "Settings.json"));
} }
} }
@ -180,89 +182,89 @@ namespace Bloxstrap.Dialogs.Menu
private readonly Preferences _window; private readonly Preferences _window;
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;
public string BloxstrapVersion { get; } = $"Version {Program.Version}"; public string BloxstrapVersion { get; } = $"Version {App.Version}";
#region Integrations #region Integrations
public bool DRPEnabled public bool DRPEnabled
{ {
get => Program.Settings.UseDiscordRichPresence; get => App.Settings.UseDiscordRichPresence;
set set
{ {
// if user wants discord rpc, auto-enable buttons by default // if user wants discord rpc, auto-enable buttons by default
_window.CheckBoxDRPButtons.IsChecked = value; _window.CheckBoxDRPButtons.IsChecked = value;
Program.Settings.UseDiscordRichPresence = value; App.Settings.UseDiscordRichPresence = value;
} }
} }
public bool DRPButtons public bool DRPButtons
{ {
get => !Program.Settings.HideRPCButtons; get => !App.Settings.HideRPCButtons;
set => Program.Settings.HideRPCButtons = !value; set => App.Settings.HideRPCButtons = !value;
} }
public bool RFUEnabled public bool RFUEnabled
{ {
get => Program.Settings.RFUEnabled; get => App.Settings.RFUEnabled;
set set
{ {
// if user wants to use rbxfpsunlocker, auto-enable autoclosing by default // if user wants to use rbxfpsunlocker, auto-enable autoclosing by default
_window.CheckBoxRFUAutoclose.IsChecked = value; _window.CheckBoxRFUAutoclose.IsChecked = value;
Program.Settings.RFUEnabled = value; App.Settings.RFUEnabled = value;
} }
} }
public bool RFUAutoclose public bool RFUAutoclose
{ {
get => Program.Settings.RFUAutoclose; get => App.Settings.RFUAutoclose;
set => Program.Settings.RFUAutoclose = value; set => App.Settings.RFUAutoclose = value;
} }
public bool UseReShade public bool UseReShade
{ {
get => Program.Settings.UseReShade; get => App.Settings.UseReShade;
set set
{ {
// if user wants to use reshade, auto-enable use of extravi's presets by default // if user wants to use reshade, auto-enable use of extravi's presets by default
_window.CheckBoxUseReShadeExtraviPresets.IsChecked = value; _window.CheckBoxUseReShadeExtraviPresets.IsChecked = value;
Program.Settings.UseReShade = value; App.Settings.UseReShade = value;
} }
} }
public bool UseReShadeExtraviPresets public bool UseReShadeExtraviPresets
{ {
get => Program.Settings.UseReShadeExtraviPresets; get => App.Settings.UseReShadeExtraviPresets;
set => Program.Settings.UseReShadeExtraviPresets = value; set => App.Settings.UseReShadeExtraviPresets = value;
} }
public bool ReShadeFolderButtonEnabled { get; } = !Program.IsFirstRun; public bool ReShadeFolderButtonEnabled { get; } = !App.IsFirstRun;
public string ReShadeFolderButtonTooltip { get; } = Program.IsFirstRun ? "Bloxstrap must first be installed before managing ReShade" : "This is the folder that contains all your ReShade resources for presets, shaders and textures."; public string ReShadeFolderButtonTooltip { get; } = App.IsFirstRun ? "Bloxstrap must first be installed before managing ReShade" : "This is the folder that contains all your ReShade resources for presets, shaders and textures.";
#endregion #endregion
#region Modifications #region Modifications
public bool ModOldDeathSound public bool ModOldDeathSound
{ {
get => Program.Settings.UseOldDeathSound; get => App.Settings.UseOldDeathSound;
set => Program.Settings.UseOldDeathSound = value; set => App.Settings.UseOldDeathSound = value;
} }
public bool ModOldMouseCursor public bool ModOldMouseCursor
{ {
get => Program.Settings.UseOldMouseCursor; get => App.Settings.UseOldMouseCursor;
set => Program.Settings.UseOldMouseCursor = value; set => App.Settings.UseOldMouseCursor = value;
} }
public bool ModDisableAppPatch public bool ModDisableAppPatch
{ {
get => Program.Settings.UseDisableAppPatch; get => App.Settings.UseDisableAppPatch;
set => Program.Settings.UseDisableAppPatch = value; set => App.Settings.UseDisableAppPatch = value;
} }
public bool ModFolderButtonEnabled { get; } = !Program.IsFirstRun; public bool ModFolderButtonEnabled { get; } = !App.IsFirstRun;
public string ModFolderButtonTooltip { get; } = Program.IsFirstRun ? "Bloxstrap must first be installed before managing mods" : "This is the folder that contains all your file modifications, including presets and any ReShade files needed."; public string ModFolderButtonTooltip { get; } = App.IsFirstRun ? "Bloxstrap must first be installed before managing mods" : "This is the folder that contains all your file modifications, including presets and any ReShade files needed.";
#endregion #endregion
#region Installation #region Installation
private string installLocation = Program.IsFirstRun ? Path.Combine(Directories.LocalAppData, Program.ProjectName) : Program.BaseDirectory; private string installLocation = App.IsFirstRun ? Path.Combine(Directories.LocalAppData, App.ProjectName) : App.BaseDirectory;
public string InstallLocation public string InstallLocation
{ {
get => installLocation; get => installLocation;
@ -273,7 +275,7 @@ namespace Bloxstrap.Dialogs.Menu
} }
} }
private bool showAllChannels = !DeployManager.ChannelsAbstracted.Contains(Program.Settings.Channel); private bool showAllChannels = !DeployManager.ChannelsAbstracted.Contains(App.Settings.Channel);
public bool ShowAllChannels public bool ShowAllChannels
{ {
get => showAllChannels; get => showAllChannels;
@ -294,7 +296,7 @@ namespace Bloxstrap.Dialogs.Menu
} }
} }
private IEnumerable<string> channels = DeployManager.ChannelsAbstracted.Contains(Program.Settings.Channel) ? DeployManager.ChannelsAbstracted : DeployManager.ChannelsAll; private IEnumerable<string> channels = DeployManager.ChannelsAbstracted.Contains(App.Settings.Channel) ? DeployManager.ChannelsAbstracted : DeployManager.ChannelsAll;
public IEnumerable<string> Channels public IEnumerable<string> Channels
{ {
get => channels; get => channels;
@ -307,11 +309,11 @@ namespace Bloxstrap.Dialogs.Menu
public string Channel public string Channel
{ {
get => Program.Settings.Channel; get => App.Settings.Channel;
set set
{ {
Task.Run(() => GetChannelInfo(value)); Task.Run(() => GetChannelInfo(value));
Program.Settings.Channel = value; App.Settings.Channel = value;
} }
} }
@ -328,8 +330,8 @@ namespace Bloxstrap.Dialogs.Menu
public bool PromptChannelChange public bool PromptChannelChange
{ {
get => Program.Settings.PromptChannelChange; get => App.Settings.PromptChannelChange;
set => Program.Settings.PromptChannelChange = value; set => App.Settings.PromptChannelChange = value;
} }
#endregion #endregion
@ -343,10 +345,10 @@ namespace Bloxstrap.Dialogs.Menu
public string Theme public string Theme
{ {
get => Themes.FirstOrDefault(x => x.Value == Program.Settings.Theme).Key; get => Themes.FirstOrDefault(x => x.Value == App.Settings.Theme).Key;
set set
{ {
Program.Settings.Theme = Themes[value]; App.Settings.Theme = Themes[value];
_window.SetTheme(); _window.SetTheme();
} }
} }
@ -361,8 +363,8 @@ namespace Bloxstrap.Dialogs.Menu
public string Dialog public string Dialog
{ {
get => Dialogs.FirstOrDefault(x => x.Value == Program.Settings.BootstrapperStyle).Key; get => Dialogs.FirstOrDefault(x => x.Value == App.Settings.BootstrapperStyle).Key;
set => Program.Settings.BootstrapperStyle = Dialogs[value]; set => App.Settings.BootstrapperStyle = Dialogs[value];
} }
public IReadOnlyDictionary<string, BootstrapperIcon> Icons { get; set; } = new Dictionary<string, BootstrapperIcon>() public IReadOnlyDictionary<string, BootstrapperIcon> Icons { get; set; } = new Dictionary<string, BootstrapperIcon>()
@ -379,29 +381,29 @@ namespace Bloxstrap.Dialogs.Menu
public string Icon public string Icon
{ {
get => Icons.FirstOrDefault(x => x.Value == Program.Settings.BootstrapperIcon).Key; get => Icons.FirstOrDefault(x => x.Value == App.Settings.BootstrapperIcon).Key;
set => Program.Settings.BootstrapperIcon = Icons[value]; set => App.Settings.BootstrapperIcon = Icons[value];
} }
public bool CreateDesktopIcon public bool CreateDesktopIcon
{ {
get => Program.Settings.CreateDesktopIcon; get => App.Settings.CreateDesktopIcon;
set => Program.Settings.CreateDesktopIcon = value; set => App.Settings.CreateDesktopIcon = value;
} }
public bool CheckForUpdates public bool CheckForUpdates
{ {
get => Program.Settings.CheckForUpdates; get => App.Settings.CheckForUpdates;
set => Program.Settings.CheckForUpdates = value; set => App.Settings.CheckForUpdates = value;
} }
#endregion #endregion
public string ConfirmButtonText { get; } = Program.IsFirstRun ? "Install" : "Save"; public string ConfirmButtonText { get; } = App.IsFirstRun ? "Install" : "Save";
public PreferencesViewModel(Preferences window) public PreferencesViewModel(Preferences window)
{ {
_window = window; _window = window;
Task.Run(() => GetChannelInfo(Program.Settings.Channel)); Task.Run(() => GetChannelInfo(App.Settings.Channel));
} }
protected void OnPropertyChanged([CallerMemberName] string? name = null) protected void OnPropertyChanged([CallerMemberName] string? name = null)
@ -414,7 +416,7 @@ namespace Bloxstrap.Dialogs.Menu
ChannelInfo = "Getting latest version info, please wait...\n"; ChannelInfo = "Getting latest version info, please wait...\n";
ClientVersion info = await DeployManager.GetLastDeploy(channel, true); ClientVersion info = await DeployManager.GetLastDeploy(channel, true);
string? strTimestamp = info.Timestamp?.ToString("MM/dd/yyyy h:mm:ss tt", Program.CultureFormat); string? strTimestamp = info.Timestamp?.ToString("MM/dd/yyyy h:mm:ss tt", App.CultureFormat);
ChannelInfo = $"Version: v{info.Version} ({info.VersionGuid})\nDeployed: {strTimestamp}"; ChannelInfo = $"Version: v{info.Version} ({info.VersionGuid})\nDeployed: {strTimestamp}";
} }

View File

@ -10,14 +10,6 @@
SizeToContent="WidthAndHeight" SizeToContent="WidthAndHeight"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"> WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="Themes\ColourfulDarkTheme.xaml" />-->
<ResourceDictionary Source="Themes\LightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Width="420" Height="220"> <Grid Width="420" Height="220">
<StackPanel Margin="10"> <StackPanel Margin="10">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="ReShade Help" VerticalAlignment="Top" FontSize="18" /> <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="ReShade Help" VerticalAlignment="Top" FontSize="18" />

View File

@ -1,6 +1,5 @@
using System.Windows; using System;
using System.Windows;
using Bloxstrap.Enums;
namespace Bloxstrap.Dialogs.Menu namespace Bloxstrap.Dialogs.Menu
{ {
@ -12,17 +11,6 @@ namespace Bloxstrap.Dialogs.Menu
public ReShadeHelp() public ReShadeHelp()
{ {
InitializeComponent(); InitializeComponent();
SetTheme();
}
public void SetTheme()
{
string theme = "Light";
if (Program.Settings.Theme.GetFinal() == Theme.Dark)
theme = "ColourfulDark";
this.Resources.MergedDictionaries[0] = new ResourceDictionary() { Source = new Uri($"Dialogs/Menu/Themes/{theme}Theme.xaml", UriKind.Relative) };
} }
private void ButtonClose_Click(object sender, EventArgs e) private void ButtonClose_Click(object sender, EventArgs e)

View File

@ -1,4 +1,6 @@
namespace Bloxstrap.Enums using System.Drawing;
namespace Bloxstrap.Enums
{ {
public enum BootstrapperIcon public enum BootstrapperIcon
{ {

View File

@ -1,4 +1,6 @@
using Bloxstrap.Dialogs.BootstrapperDialogs; using System.Windows.Forms;
using Bloxstrap.Dialogs.BootstrapperDialogs;
namespace Bloxstrap.Enums namespace Bloxstrap.Enums
{ {
@ -36,14 +38,8 @@ namespace Bloxstrap.Enums
break; break;
} }
if (bootstrapper is null) if (!App.IsQuiet)
{
dialog.ShowDialog(); dialog.ShowDialog();
} }
else
{
Application.Run(dialog);
}
}
} }
} }

View File

@ -1,5 +1,10 @@
using System.Net.Http; using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks;
using Bloxstrap.Models; using Bloxstrap.Models;
namespace Bloxstrap.Helpers namespace Bloxstrap.Helpers
@ -55,7 +60,7 @@ namespace Bloxstrap.Helpers
public static async Task<ClientVersion> GetLastDeploy(string channel, bool timestamp = false) public static async Task<ClientVersion> GetLastDeploy(string channel, bool timestamp = false)
{ {
HttpResponseMessage deployInfoResponse = await Program.HttpClient.GetAsync($"https://clientsettings.roblox.com/v2/client-version/WindowsPlayer/channel/{channel}"); HttpResponseMessage deployInfoResponse = await App.HttpClient.GetAsync($"https://clientsettings.roblox.com/v2/client-version/WindowsPlayer/channel/{channel}");
if (!deployInfoResponse.IsSuccessStatusCode) if (!deployInfoResponse.IsSuccessStatusCode)
{ {
@ -75,7 +80,7 @@ namespace Bloxstrap.Helpers
string channelUrl = BuildBaseUrl(channel); string channelUrl = BuildBaseUrl(channel);
// get an approximate deploy time from rbxpkgmanifest's last modified date // get an approximate deploy time from rbxpkgmanifest's last modified date
HttpResponseMessage pkgResponse = await Program.HttpClient.GetAsync($"{channelUrl}/{clientVersion.VersionGuid}-rbxPkgManifest.txt"); HttpResponseMessage pkgResponse = await App.HttpClient.GetAsync($"{channelUrl}/{clientVersion.VersionGuid}-rbxPkgManifest.txt");
if (pkgResponse.Content.Headers.TryGetValues("last-modified", out var values)) if (pkgResponse.Content.Headers.TryGetValues("last-modified", out var values))
{ {
string lastModified = values.First(); string lastModified = values.First();

View File

@ -1,4 +1,5 @@
using System.IO; using System;
using System.IO;
namespace Bloxstrap.Helpers namespace Bloxstrap.Helpers
{ {
@ -8,7 +9,7 @@ namespace Bloxstrap.Helpers
// so these can safely be called before initialization // so these can safely be called before initialization
public static string LocalAppData { get => Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); } public static string LocalAppData { get => Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); }
public static string Desktop { get => Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); } public static string Desktop { get => Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); }
public static string StartMenu { get => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs", Program.ProjectName); } public static string StartMenu { get => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs", App.ProjectName); }
public static string Base { get; private set; } = ""; public static string Base { get; private set; } = "";
public static string Downloads { get; private set; } = ""; public static string Downloads { get; private set; } = "";
@ -18,7 +19,7 @@ namespace Bloxstrap.Helpers
public static string Updates { get; private set; } = ""; public static string Updates { get; private set; } = "";
public static string ReShade { get; private set; } = ""; public static string ReShade { get; private set; } = "";
public static string App { get; private set; } = ""; public static string Application { get; private set; } = "";
public static bool Initialized { get => String.IsNullOrEmpty(Base); } public static bool Initialized { get => String.IsNullOrEmpty(Base); }
@ -32,7 +33,7 @@ namespace Bloxstrap.Helpers
Updates = Path.Combine(Base, "Updates"); Updates = Path.Combine(Base, "Updates");
ReShade = Path.Combine(Base, "ReShade"); ReShade = Path.Combine(Base, "ReShade");
App = Path.Combine(Base, $"{Program.ProjectName}.exe"); Application = Path.Combine(Base, $"{App.ProjectName}.exe");
} }
} }
} }

View File

@ -1,6 +1,11 @@
using System.Diagnostics; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Bloxstrap.Models; using Bloxstrap.Models;
@ -169,7 +174,7 @@ namespace Bloxstrap.Helpers.Integrations
} }
}; };
if (!Program.Settings.HideRPCButtons) if (!App.Settings.HideRPCButtons)
{ {
buttons.Insert(0, new DiscordRPC.Button() buttons.Insert(0, new DiscordRPC.Button()
{ {

View File

@ -1,7 +1,8 @@
using System.Diagnostics; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Net.Http; using System.Threading.Tasks;
using Bloxstrap.Models; using Bloxstrap.Models;
@ -40,7 +41,7 @@ namespace Bloxstrap.Helpers.Integrations
if (process.MainModule is null || process.MainModule.FileName is null) if (process.MainModule is null || process.MainModule.FileName is null)
continue; continue;
if (!process.MainModule.FileName.Contains(Program.BaseDirectory)) if (!process.MainModule.FileName.Contains(App.BaseDirectory))
continue; continue;
process.Kill(); process.Kill();
@ -52,14 +53,14 @@ namespace Bloxstrap.Helpers.Integrations
public static async Task CheckInstall() public static async Task CheckInstall()
{ {
if (Program.BaseDirectory is null) if (App.BaseDirectory is null)
return; return;
string folderLocation = Path.Combine(Program.BaseDirectory, "Integrations\\rbxfpsunlocker"); string folderLocation = Path.Combine(App.BaseDirectory, "Integrations\\rbxfpsunlocker");
string fileLocation = Path.Combine(folderLocation, "rbxfpsunlocker.exe"); string fileLocation = Path.Combine(folderLocation, "rbxfpsunlocker.exe");
string settingsLocation = Path.Combine(folderLocation, "settings"); string settingsLocation = Path.Combine(folderLocation, "settings");
if (!Program.Settings.RFUEnabled) if (!App.Settings.RFUEnabled)
{ {
if (Directory.Exists(folderLocation)) if (Directory.Exists(folderLocation))
{ {
@ -82,7 +83,7 @@ namespace Bloxstrap.Helpers.Integrations
if (File.Exists(fileLocation)) if (File.Exists(fileLocation))
{ {
// no new release published, return // no new release published, return
if (Program.Settings.RFUVersion == releaseInfo.TagName) if (App.Settings.RFUVersion == releaseInfo.TagName)
return; return;
CheckIfRunning(); CheckIfRunning();
@ -92,7 +93,7 @@ namespace Bloxstrap.Helpers.Integrations
Debug.WriteLine("Installing/Updating rbxfpsunlocker..."); Debug.WriteLine("Installing/Updating rbxfpsunlocker...");
{ {
byte[] bytes = await Program.HttpClient.GetByteArrayAsync(downloadUrl); byte[] bytes = await App.HttpClient.GetByteArrayAsync(downloadUrl);
using MemoryStream zipStream = new(bytes); using MemoryStream zipStream = new(bytes);
using ZipArchive archive = new(zipStream); using ZipArchive archive = new(zipStream);
@ -103,7 +104,7 @@ namespace Bloxstrap.Helpers.Integrations
if (!File.Exists(settingsLocation)) if (!File.Exists(settingsLocation))
await File.WriteAllTextAsync(settingsLocation, Settings); await File.WriteAllTextAsync(settingsLocation, Settings);
Program.Settings.RFUVersion = releaseInfo.TagName; App.Settings.RFUVersion = releaseInfo.TagName;
} }
} }
} }

View File

@ -1,6 +1,10 @@
using System.Diagnostics; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using Bloxstrap.Models; using Bloxstrap.Models;
@ -65,7 +69,7 @@ namespace Bloxstrap.Helpers.Integrations
Debug.WriteLine("[ReShade] Downloading/Upgrading config file..."); Debug.WriteLine("[ReShade] Downloading/Upgrading config file...");
{ {
byte[] bytes = await Program.HttpClient.GetByteArrayAsync($"{BaseUrl}/config.zip"); byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/config.zip");
using MemoryStream zipStream = new(bytes); using MemoryStream zipStream = new(bytes);
using ZipArchive archive = new(zipStream); using ZipArchive archive = new(zipStream);
@ -121,7 +125,7 @@ namespace Bloxstrap.Helpers.Integrations
// config synchronization will be done whenever roblox updates or whenever we launch roblox // config synchronization will be done whenever roblox updates or whenever we launch roblox
string modFolderConfigPath = ConfigLocation; string modFolderConfigPath = ConfigLocation;
string versionFolderConfigPath = Path.Combine(Directories.Versions, Program.Settings.VersionGuid, "ReShade.ini"); string versionFolderConfigPath = Path.Combine(Directories.Versions, App.Settings.VersionGuid, "ReShade.ini");
// we shouldn't be here if the mod config doesn't already exist // we shouldn't be here if the mod config doesn't already exist
if (!File.Exists(modFolderConfigPath)) if (!File.Exists(modFolderConfigPath))
@ -172,7 +176,7 @@ namespace Bloxstrap.Helpers.Integrations
Debug.WriteLine($"[ReShade] Downloading shaders for {name}"); Debug.WriteLine($"[ReShade] Downloading shaders for {name}");
{ {
byte[] bytes = await Program.HttpClient.GetByteArrayAsync(downloadUrl); byte[] bytes = await App.HttpClient.GetByteArrayAsync(downloadUrl);
using MemoryStream zipStream = new(bytes); using MemoryStream zipStream = new(bytes);
using ZipArchive archive = new(zipStream); using ZipArchive archive = new(zipStream);
@ -273,7 +277,7 @@ namespace Bloxstrap.Helpers.Integrations
foreach (string name in ExtraviPresetsShaders) foreach (string name in ExtraviPresetsShaders)
await DownloadShaders(name); await DownloadShaders(name);
byte[] bytes = await Program.HttpClient.GetByteArrayAsync($"{BaseUrl}/reshade-presets.zip"); byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/reshade-presets.zip");
using MemoryStream zipStream = new(bytes); using MemoryStream zipStream = new(bytes);
using ZipArchive archive = new(zipStream); using ZipArchive archive = new(zipStream);
@ -320,13 +324,13 @@ namespace Bloxstrap.Helpers.Integrations
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Textures")); Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Textures"));
Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Presets")); Directory.CreateDirectory(Path.Combine(Directories.ReShade, "Presets"));
if (!Program.Settings.UseReShadeExtraviPresets) if (!App.Settings.UseReShadeExtraviPresets)
{ {
UninstallExtraviPresets(); UninstallExtraviPresets();
Program.Settings.ExtraviPresetsVersion = ""; App.Settings.ExtraviPresetsVersion = "";
} }
if (!Program.Settings.UseReShade) if (!App.Settings.UseReShade)
{ {
Debug.WriteLine("[ReShade] Uninstalling ReShade..."); Debug.WriteLine("[ReShade] Uninstalling ReShade...");
@ -334,7 +338,7 @@ namespace Bloxstrap.Helpers.Integrations
File.Delete(injectorLocation); File.Delete(injectorLocation);
File.Delete(ConfigLocation); File.Delete(ConfigLocation);
Program.Settings.ReShadeConfigVersion = ""; App.Settings.ReShadeConfigVersion = "";
DeleteShaders("Stock"); DeleteShaders("Stock");
@ -361,7 +365,7 @@ namespace Bloxstrap.Helpers.Integrations
// check if we should download a fresh copy of the config // check if we should download a fresh copy of the config
// extravi may need to update the config ota, in which case we'll redownload it // extravi may need to update the config ota, in which case we'll redownload it
if (!File.Exists(ConfigLocation) || versionManifest is not null && Program.Settings.ReShadeConfigVersion != versionManifest.ConfigFile) if (!File.Exists(ConfigLocation) || versionManifest is not null && App.Settings.ReShadeConfigVersion != versionManifest.ConfigFile)
shouldFetchConfig = true; shouldFetchConfig = true;
if (shouldFetchReShade) if (shouldFetchReShade)
@ -369,7 +373,7 @@ namespace Bloxstrap.Helpers.Integrations
Debug.WriteLine("[ReShade] Installing/Upgrading ReShade..."); Debug.WriteLine("[ReShade] Installing/Upgrading ReShade...");
{ {
byte[] bytes = await Program.HttpClient.GetByteArrayAsync($"{BaseUrl}/dxgi.zip"); byte[] bytes = await App.HttpClient.GetByteArrayAsync($"{BaseUrl}/dxgi.zip");
using MemoryStream zipStream = new(bytes); using MemoryStream zipStream = new(bytes);
using ZipArchive archive = new(zipStream); using ZipArchive archive = new(zipStream);
archive.ExtractToDirectory(Directories.Modifications, true); archive.ExtractToDirectory(Directories.Modifications, true);
@ -381,15 +385,15 @@ namespace Bloxstrap.Helpers.Integrations
await DownloadConfig(); await DownloadConfig();
if (versionManifest is not null) if (versionManifest is not null)
Program.Settings.ReShadeConfigVersion = versionManifest.ConfigFile; App.Settings.ReShadeConfigVersion = versionManifest.ConfigFile;
} }
await DownloadShaders("Stock"); await DownloadShaders("Stock");
if (Program.Settings.UseReShadeExtraviPresets && Program.Settings.ExtraviPresetsVersion != versionManifest!.Presets) if (App.Settings.UseReShadeExtraviPresets && App.Settings.ExtraviPresetsVersion != versionManifest!.Presets)
{ {
await InstallExtraviPresets(); await InstallExtraviPresets();
Program.Settings.ExtraviPresetsVersion = versionManifest.Presets; App.Settings.ExtraviPresetsVersion = versionManifest.Presets;
} }
SynchronizeConfigFile(); SynchronizeConfigFile();

View File

@ -1,6 +1,10 @@
using System.Diagnostics; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text; using System.Text;
using System.Web; using System.Web;
using System.Windows;
using Microsoft.Win32; using Microsoft.Win32;
namespace Bloxstrap.Helpers namespace Bloxstrap.Helpers
@ -36,7 +40,7 @@ namespace Bloxstrap.Helpers
key = keyvalPair[0]; key = keyvalPair[0];
val = keyvalPair[1]; val = keyvalPair[1];
if (!UriKeyArgMap.ContainsKey(key) || String.IsNullOrEmpty(val)) if (!UriKeyArgMap.ContainsKey(key) || string.IsNullOrEmpty(val))
continue; continue;
if (key == "launchmode" && val == "play") if (key == "launchmode" && val == "play")
@ -47,17 +51,17 @@ namespace Bloxstrap.Helpers
if (key == "channel") if (key == "channel")
{ {
if (val.ToLower() != Program.Settings.Channel.ToLower()) if (val.ToLower() != App.Settings.Channel.ToLower())
{ {
DialogResult result = !Program.Settings.PromptChannelChange ? DialogResult.Yes : Program.ShowMessageBox( MessageBoxResult result = !App.Settings.PromptChannelChange ? MessageBoxResult.Yes : App.ShowMessageBox(
$"{Program.ProjectName} was launched with the Roblox build channel set to {val}, however your current preferred channel is {Program.Settings.Channel}.\n\n" + $"{App.ProjectName} was launched with the Roblox build channel set to {val}, however your current preferred channel is {App.Settings.Channel}.\n\n" +
$"Would you like to switch channels from {Program.Settings.Channel} to {val}?", $"Would you like to switch channels from {App.Settings.Channel} to {val}?",
MessageBoxIcon.Question, MessageBoxImage.Question,
MessageBoxButtons.YesNo MessageBoxButton.YesNo
); );
if (result == DialogResult.Yes) if (result == MessageBoxResult.Yes)
Program.Settings.Channel = val; App.Settings.Channel = val;
} }
// we'll set the arg when launching // we'll set the arg when launching

View File

@ -1,7 +1,9 @@
// https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Bootstrapper/PackageManifest.cs // https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Bootstrapper/PackageManifest.cs
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net.Http; using System.Threading.Tasks;
namespace Bloxstrap.Helpers.RSMM namespace Bloxstrap.Helpers.RSMM
{ {
@ -49,7 +51,7 @@ namespace Bloxstrap.Helpers.RSMM
public static async Task<PackageManifest> Get(string versionGuid) public static async Task<PackageManifest> Get(string versionGuid)
{ {
string pkgManifestUrl = $"{DeployManager.BaseUrl}/{versionGuid}-rbxPkgManifest.txt"; string pkgManifestUrl = $"{DeployManager.BaseUrl}/{versionGuid}-rbxPkgManifest.txt";
var pkgManifestData = await Program.HttpClient.GetStringAsync(pkgManifestUrl); var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl);
return new PackageManifest(pkgManifestData); return new PackageManifest(pkgManifestData);
} }

View File

@ -1,5 +1,9 @@
// https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Utility/SystemEvent.cs // https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Utility/SystemEvent.cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Bloxstrap.Helpers.RSMM namespace Bloxstrap.Helpers.RSMM
{ {
public class SystemEvent : EventWaitHandle public class SystemEvent : EventWaitHandle

View File

@ -1,5 +1,7 @@
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
namespace Bloxstrap.Helpers namespace Bloxstrap.Helpers
{ {

View File

@ -1,5 +1,7 @@
using System.Diagnostics; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows;
using Bloxstrap.Dialogs.Menu; using Bloxstrap.Dialogs.Menu;
@ -9,55 +11,55 @@ namespace Bloxstrap.Helpers
{ {
public static void CheckInstalledVersion() public static void CheckInstalledVersion()
{ {
if (Environment.ProcessPath is null || !File.Exists(Directories.App) || Environment.ProcessPath == Directories.App) if (Environment.ProcessPath is null || !File.Exists(Directories.Application) || Environment.ProcessPath == Directories.Application)
return; return;
bool isAutoUpgrade = Environment.ProcessPath.StartsWith(Directories.Updates); bool isAutoUpgrade = Environment.ProcessPath.StartsWith(Directories.Updates);
// if downloaded version doesn't match, replace installed version with downloaded version // if downloaded version doesn't match, replace installed version with downloaded version
FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath); FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath);
FileVersionInfo installedVersionInfo = FileVersionInfo.GetVersionInfo(Directories.App); FileVersionInfo installedVersionInfo = FileVersionInfo.GetVersionInfo(Directories.Application);
if (installedVersionInfo.ProductVersion == currentVersionInfo.ProductVersion) if (installedVersionInfo.ProductVersion == currentVersionInfo.ProductVersion)
return; return;
DialogResult result; MessageBoxResult result;
// silently upgrade version if the command line flag is set or if we're launching from an auto update // silently upgrade version if the command line flag is set or if we're launching from an auto update
if (Program.IsUpgrade || isAutoUpgrade) if (App.IsUpgrade || isAutoUpgrade)
{ {
result = DialogResult.Yes; result = MessageBoxResult.Yes;
} }
else else
{ {
result = Program.ShowMessageBox( result = App.ShowMessageBox(
$"The version of {Program.ProjectName} you've launched is different to the version you currently have installed.\nWould you like to upgrade your currently installed version?", $"The version of {App.ProjectName} you've launched is different to the version you currently have installed.\nWould you like to upgrade your currently installed version?",
MessageBoxIcon.Question, MessageBoxImage.Question,
MessageBoxButtons.YesNo MessageBoxButton.YesNo
); );
} }
if (result != DialogResult.Yes) if (result != MessageBoxResult.Yes)
return; return;
File.Delete(Directories.App); File.Delete(Directories.Application);
File.Copy(Environment.ProcessPath, Directories.App); File.Copy(Environment.ProcessPath, Directories.Application);
Bootstrapper.Register(); Bootstrapper.Register();
if (Program.IsQuiet || isAutoUpgrade) if (App.IsQuiet || isAutoUpgrade)
return; return;
Program.ShowMessageBox( App.ShowMessageBox(
$"{Program.ProjectName} has been updated to v{currentVersionInfo.ProductVersion}", $"{App.ProjectName} has been updated to v{currentVersionInfo.ProductVersion}",
MessageBoxIcon.Information, MessageBoxImage.Information,
MessageBoxButtons.OK MessageBoxButton.OK
); );
new Preferences().ShowDialog(); new Preferences().ShowDialog();
Program.Exit(); App.Terminate();
} }
} }
} }

View File

@ -1,8 +1,10 @@
using System.Diagnostics; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks;
namespace Bloxstrap.Helpers namespace Bloxstrap.Helpers
{ {
@ -33,7 +35,7 @@ namespace Bloxstrap.Helpers
{ {
try try
{ {
string json = await Program.HttpClient.GetStringAsync(url); string json = await App.HttpClient.GetStringAsync(url);
return JsonSerializer.Deserialize<T>(json); return JsonSerializer.Deserialize<T>(json);
} }
catch (Exception) catch (Exception)

View File

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Forms;
namespace Bloxstrap.Helpers namespace Bloxstrap.Helpers
{ {

View File

@ -1,4 +1,5 @@
using System.Text.Json.Serialization; using System;
using System.Text.Json.Serialization;
namespace Bloxstrap.Models namespace Bloxstrap.Models
{ {

View File

@ -1,4 +1,5 @@
using System.Text.Json.Serialization; using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Bloxstrap.Models namespace Bloxstrap.Models
{ {

View File

@ -1,4 +1,5 @@
using System.Text.Json.Serialization; using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Bloxstrap.Models namespace Bloxstrap.Models
{ {

View File

@ -0,0 +1,7 @@
{
"profiles": {
"Bloxstrap": {
"commandName": "Project"
}
}
}

View File

@ -1,6 +1,8 @@
using System.Diagnostics; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Text.Json; using System.Text.Json;
using System.Threading;
using Bloxstrap.Models; using Bloxstrap.Models;