mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Merge pull request #74 from pizzaboxer/wpf-migration
Migrate project base from WinForms to WPF
This commit is contained in:
commit
695384fffb
@ -1,9 +1,9 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32014.148
|
||||
VisualStudioVersion = 17.3.32819.101
|
||||
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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -11,15 +11,15 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{646D1D58-C9CA-48C9-BBCD-30585A1DAAF1}.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}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0D75146E-DA24-4B05-B6C9-250C8F81B0C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F989AC04-B48F-4BB4-B940-1E7D082F14DA}
|
||||
SolutionGuid = {ED269E5D-8C72-49B4-A76F-51CF163511C1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
13
Bloxstrap/App.xaml
Normal file
13
Bloxstrap/App.xaml
Normal 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>
|
@ -1,21 +1,25 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
using Bloxstrap.Helpers;
|
||||
using Bloxstrap.Models;
|
||||
using Bloxstrap.Dialogs.Menu;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
using Bloxstrap.Helpers;
|
||||
|
||||
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 static readonly CultureInfo CultureFormat = CultureInfo.InvariantCulture;
|
||||
@ -39,47 +43,45 @@ namespace Bloxstrap
|
||||
public static readonly HttpClient HttpClient = new(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All });
|
||||
|
||||
// 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)
|
||||
return DialogResult.None;
|
||||
return MessageBoxResult.None;
|
||||
|
||||
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();
|
||||
Environment.Exit(code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
|
||||
LaunchArgs = args;
|
||||
LaunchArgs = e.Args;
|
||||
|
||||
HttpClient.Timeout = TimeSpan.FromMinutes(5);
|
||||
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;
|
||||
|
||||
if (Array.IndexOf(args, "-uninstall") != -1)
|
||||
if (Array.IndexOf(LaunchArgs, "-uninstall") != -1)
|
||||
IsUninstall = true;
|
||||
|
||||
if (Array.IndexOf(args, "-nolaunch") != -1)
|
||||
if (Array.IndexOf(LaunchArgs, "-nolaunch") != -1)
|
||||
IsNoLaunch = true;
|
||||
|
||||
if (Array.IndexOf(args, "-upgrade") != -1)
|
||||
if (Array.IndexOf(LaunchArgs, "-upgrade") != -1)
|
||||
IsUpgrade = true;
|
||||
}
|
||||
|
||||
@ -126,28 +128,28 @@ namespace Bloxstrap
|
||||
|
||||
string commandLine = "";
|
||||
|
||||
#if false//DEBUG
|
||||
#if DEBUG
|
||||
new Preferences().ShowDialog();
|
||||
#else
|
||||
if (args.Length > 0)
|
||||
if (LaunchArgs.Length > 0)
|
||||
{
|
||||
if (args[0] == "-preferences")
|
||||
if (LaunchArgs[0] == "-preferences")
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
10
Bloxstrap/AssemblyInfo.cs
Normal file
10
Bloxstrap/AssemblyInfo.cs
Normal 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)
|
||||
)]
|
@ -4,14 +4,11 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Platforms>AnyCPU;x86</Platforms>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
|
||||
<Version>1.7.0</Version>
|
||||
<FileVersion>1.7.0.0</FileVersion>
|
||||
<Version>2.0.0</Version>
|
||||
<FileVersion>2.0.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -30,32 +27,4 @@
|
||||
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
|
||||
</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>
|
@ -1,18 +1,21 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
using Bloxstrap.Dialogs.BootstrapperDialogs;
|
||||
using Bloxstrap.Helpers;
|
||||
using Bloxstrap.Helpers.Integrations;
|
||||
using Bloxstrap.Helpers.RSMM;
|
||||
using Bloxstrap.Models;
|
||||
using System.Net;
|
||||
using Bloxstrap.Properties;
|
||||
|
||||
namespace Bloxstrap
|
||||
{
|
||||
@ -82,23 +85,20 @@ namespace Bloxstrap
|
||||
public Bootstrapper(string? launchCommandLine = null)
|
||||
{
|
||||
LaunchCommandLine = launchCommandLine;
|
||||
FreshInstall = String.IsNullOrEmpty(Program.Settings.VersionGuid);
|
||||
FreshInstall = String.IsNullOrEmpty(App.Settings.VersionGuid);
|
||||
}
|
||||
|
||||
// this is called from BootstrapperStyleForm.SetupDialog()
|
||||
public async Task Run()
|
||||
{
|
||||
if (Program.IsQuiet)
|
||||
Dialog.CloseDialog();
|
||||
|
||||
if (Program.IsUninstall)
|
||||
if (App.IsUninstall)
|
||||
{
|
||||
Uninstall();
|
||||
return;
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
if (!Program.IsFirstRun && Program.Settings.CheckForUpdates)
|
||||
if (!App.IsFirstRun && App.Settings.CheckForUpdates)
|
||||
await CheckForUpdates();
|
||||
#endif
|
||||
|
||||
@ -106,39 +106,39 @@ namespace Bloxstrap
|
||||
|
||||
// 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 (!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 ApplyModifications();
|
||||
|
||||
if (Program.IsFirstRun)
|
||||
Program.SettingsManager.ShouldSave = true;
|
||||
if (App.IsFirstRun)
|
||||
App.SettingsManager.ShouldSave = true;
|
||||
|
||||
if (Program.IsFirstRun || FreshInstall)
|
||||
if (App.IsFirstRun || FreshInstall)
|
||||
Register();
|
||||
|
||||
CheckInstall();
|
||||
|
||||
await RbxFpsUnlocker.CheckInstall();
|
||||
|
||||
Program.SettingsManager.Save();
|
||||
App.SettingsManager.Save();
|
||||
|
||||
if (Program.IsFirstRun && Program.IsNoLaunch)
|
||||
Dialog.ShowSuccess($"{Program.ProjectName} has successfully installed");
|
||||
else if (!Program.IsNoLaunch)
|
||||
if (App.IsFirstRun && App.IsNoLaunch)
|
||||
Dialog.ShowSuccess($"{App.ProjectName} has successfully installed");
|
||||
else if (!App.IsNoLaunch)
|
||||
await StartRoblox();
|
||||
}
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
Dialog.Message = "Getting the latest Bloxstrap...";
|
||||
Dialog.Message = $"Getting the latest {App.ProjectName}...";
|
||||
|
||||
// 64-bit is always the first option
|
||||
GithubReleaseAsset asset = releaseInfo.Assets[Environment.Is64BitOperatingSystem ? 0 : 1];
|
||||
@ -150,7 +150,7 @@ namespace Bloxstrap
|
||||
|
||||
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))
|
||||
{
|
||||
@ -165,10 +165,10 @@ namespace Bloxstrap
|
||||
FileName = downloadLocation,
|
||||
};
|
||||
|
||||
foreach (string arg in Program.LaunchArgs)
|
||||
foreach (string arg in App.LaunchArgs)
|
||||
startInfo.ArgumentList.Add(arg);
|
||||
|
||||
Program.SettingsManager.Save();
|
||||
App.SettingsManager.Save();
|
||||
|
||||
Process.Start(startInfo);
|
||||
|
||||
@ -179,7 +179,7 @@ namespace Bloxstrap
|
||||
{
|
||||
Dialog.Message = "Connecting to Roblox...";
|
||||
|
||||
ClientVersion clientVersion = await DeployManager.GetLastDeploy(Program.Settings.Channel);
|
||||
ClientVersion clientVersion = await DeployManager.GetLastDeploy(App.Settings.Channel);
|
||||
VersionGuid = clientVersion.VersionGuid;
|
||||
VersionFolder = Path.Combine(Directories.Versions, VersionGuid);
|
||||
VersionPackageManifest = await PackageManifest.Get(VersionGuid);
|
||||
@ -214,11 +214,11 @@ namespace Bloxstrap
|
||||
|
||||
private async Task StartRoblox()
|
||||
{
|
||||
string startEventName = Program.ProjectName.Replace(" ", "") + "StartEvent";
|
||||
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
|
||||
|
||||
Dialog.Message = "Starting Roblox...";
|
||||
|
||||
if (LaunchCommandLine == "--app" && Program.Settings.UseDisableAppPatch)
|
||||
if (LaunchCommandLine == "--app" && App.Settings.UseDisableAppPatch)
|
||||
{
|
||||
Utilities.OpenWebsite("https://www.roblox.com/games");
|
||||
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
|
||||
LaunchCommandLine += " --launchtime=" + DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
||||
if (Program.Settings.Channel.ToLower() != DeployManager.DefaultChannel.ToLower())
|
||||
LaunchCommandLine += " -channel " + Program.Settings.Channel.ToLower();
|
||||
if (App.Settings.Channel.ToLower() != DeployManager.DefaultChannel.ToLower())
|
||||
LaunchCommandLine += " -channel " + App.Settings.Channel.ToLower();
|
||||
|
||||
LaunchCommandLine += " -startEvent " + startEventName;
|
||||
|
||||
@ -247,7 +247,7 @@ namespace Bloxstrap
|
||||
if (!startEventFired)
|
||||
return;
|
||||
|
||||
if (Program.Settings.RFUEnabled && Process.GetProcessesByName("rbxfpsunlocker").Length == 0)
|
||||
if (App.Settings.RFUEnabled && Process.GetProcessesByName("rbxfpsunlocker").Length == 0)
|
||||
{
|
||||
ProcessStartInfo startInfo = new()
|
||||
{
|
||||
@ -257,7 +257,7 @@ namespace Bloxstrap
|
||||
|
||||
rbxFpsUnlocker = Process.Start(startInfo);
|
||||
|
||||
if (Program.Settings.RFUAutoclose)
|
||||
if (App.Settings.RFUAutoclose)
|
||||
shouldWait = true;
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ namespace Bloxstrap
|
||||
await Task.Delay(3000);
|
||||
|
||||
// now we move onto handling rich presence
|
||||
if (Program.Settings.UseDiscordRichPresence)
|
||||
if (App.Settings.UseDiscordRichPresence)
|
||||
{
|
||||
richPresence = new DiscordRichPresence();
|
||||
richPresence.MonitorGameActivity();
|
||||
@ -283,7 +283,7 @@ namespace Bloxstrap
|
||||
if (richPresence is not null)
|
||||
richPresence.Dispose();
|
||||
|
||||
if (Program.Settings.RFUAutoclose && rbxFpsUnlocker is not null)
|
||||
if (App.Settings.RFUAutoclose && rbxFpsUnlocker is not null)
|
||||
rbxFpsUnlocker.Kill();
|
||||
}
|
||||
}
|
||||
@ -292,7 +292,7 @@ namespace Bloxstrap
|
||||
{
|
||||
if (!Dialog.CancelEnabled)
|
||||
{
|
||||
Program.Exit(ERROR_INSTALL_USEREXIT);
|
||||
App.Terminate(ERROR_INSTALL_USEREXIT);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -300,21 +300,21 @@ namespace Bloxstrap
|
||||
|
||||
try
|
||||
{
|
||||
if (Program.IsFirstRun)
|
||||
if (App.IsFirstRun)
|
||||
Directory.Delete(Directories.Base, true);
|
||||
else if (Directory.Exists(VersionFolder))
|
||||
Directory.Delete(VersionFolder, true);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
Program.Exit(ERROR_INSTALL_USEREXIT);
|
||||
App.Terminate(ERROR_INSTALL_USEREXIT);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region App Install
|
||||
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
|
||||
string? oldInstallLocation = (string?)applicationKey.GetValue("OldInstallLocation");
|
||||
@ -334,10 +334,10 @@ namespace Bloxstrap
|
||||
applicationKey.Close();
|
||||
|
||||
// set uninstall key
|
||||
RegistryKey uninstallKey = Registry.CurrentUser.CreateSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{Program.ProjectName}");
|
||||
uninstallKey.SetValue("DisplayIcon", $"{Directories.App},0");
|
||||
uninstallKey.SetValue("DisplayName", Program.ProjectName);
|
||||
uninstallKey.SetValue("DisplayVersion", Program.Version);
|
||||
RegistryKey uninstallKey = Registry.CurrentUser.CreateSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{App.ProjectName}");
|
||||
uninstallKey.SetValue("DisplayIcon", $"{Directories.Application},0");
|
||||
uninstallKey.SetValue("DisplayName", App.ProjectName);
|
||||
uninstallKey.SetValue("DisplayVersion", App.Version);
|
||||
|
||||
if (uninstallKey.GetValue("InstallDate") is null)
|
||||
uninstallKey.SetValue("InstallDate", DateTime.Now.ToString("yyyyMMdd"));
|
||||
@ -345,11 +345,11 @@ namespace Bloxstrap
|
||||
uninstallKey.SetValue("InstallLocation", Directories.Base);
|
||||
uninstallKey.SetValue("NoRepair", 1);
|
||||
uninstallKey.SetValue("Publisher", "pizzaboxer");
|
||||
uninstallKey.SetValue("ModifyPath", $"\"{Directories.App}\" -preferences");
|
||||
uninstallKey.SetValue("QuietUninstallString", $"\"{Directories.App}\" -uninstall -quiet");
|
||||
uninstallKey.SetValue("UninstallString", $"\"{Directories.App}\" -uninstall");
|
||||
uninstallKey.SetValue("URLInfoAbout", $"https://github.com/{Program.ProjectRepository}");
|
||||
uninstallKey.SetValue("URLUpdateInfo", $"https://github.com/{Program.ProjectRepository}/releases/latest");
|
||||
uninstallKey.SetValue("ModifyPath", $"\"{Directories.Application}\" -preferences");
|
||||
uninstallKey.SetValue("QuietUninstallString", $"\"{Directories.Application}\" -uninstall -quiet");
|
||||
uninstallKey.SetValue("UninstallString", $"\"{Directories.Application}\" -uninstall");
|
||||
uninstallKey.SetValue("URLInfoAbout", $"https://github.com/{App.ProjectRepository}");
|
||||
uninstallKey.SetValue("URLUpdateInfo", $"https://github.com/{App.ProjectRepository}/releases/latest");
|
||||
uninstallKey.Close();
|
||||
}
|
||||
|
||||
@ -359,16 +359,16 @@ namespace Bloxstrap
|
||||
// this doesn't go under register, so we check every launch
|
||||
// just in case the stock bootstrapper changes it back
|
||||
|
||||
Protocol.Register("roblox", "Roblox", Directories.App);
|
||||
Protocol.Register("roblox-player", "Roblox", Directories.App);
|
||||
Protocol.Register("roblox", "Roblox", Directories.Application);
|
||||
Protocol.Register("roblox-player", "Roblox", Directories.Application);
|
||||
|
||||
// in case the user is reinstalling
|
||||
if (File.Exists(Directories.App) && Program.IsFirstRun)
|
||||
File.Delete(Directories.App);
|
||||
if (File.Exists(Directories.Application) && App.IsFirstRun)
|
||||
File.Delete(Directories.Application);
|
||||
|
||||
// check to make sure bootstrapper is in the install folder
|
||||
if (!File.Exists(Directories.App) && Environment.ProcessPath is not null)
|
||||
File.Copy(Environment.ProcessPath, Directories.App);
|
||||
if (!File.Exists(Directories.Application) && Environment.ProcessPath is not null)
|
||||
File.Copy(Environment.ProcessPath, Directories.Application);
|
||||
|
||||
// this SHOULD go under Register(),
|
||||
// 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);
|
||||
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.App, "", Directories.App, 0)
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.Application, "", Directories.Application, 0)
|
||||
.WriteToFile(Path.Combine(Directories.StartMenu, "Play Roblox.lnk"));
|
||||
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.App, "-preferences", Directories.App, 0)
|
||||
.WriteToFile(Path.Combine(Directories.StartMenu, $"Configure {Program.ProjectName}.lnk"));
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.Application, "-preferences", Directories.Application, 0)
|
||||
.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"));
|
||||
}
|
||||
}
|
||||
@ -395,9 +395,9 @@ namespace Bloxstrap
|
||||
{
|
||||
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
|
||||
RegistryKey? bootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-player");
|
||||
@ -419,7 +419,7 @@ namespace Bloxstrap
|
||||
try
|
||||
{
|
||||
// delete application key
|
||||
Registry.CurrentUser.DeleteSubKey($@"Software\{Program.ProjectName}");
|
||||
Registry.CurrentUser.DeleteSubKey($@"Software\{App.ProjectName}");
|
||||
|
||||
// delete start menu folder
|
||||
Directory.Delete(Directories.StartMenu, true);
|
||||
@ -428,7 +428,7 @@ namespace Bloxstrap
|
||||
File.Delete(Path.Combine(Directories.Desktop, "Play Roblox.lnk"));
|
||||
|
||||
// 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
|
||||
// (should delete everything except bloxstrap itself)
|
||||
@ -439,9 +439,9 @@ namespace Bloxstrap
|
||||
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
|
||||
|
||||
@ -462,8 +462,8 @@ namespace Bloxstrap
|
||||
// check if we have at least 300 megabytes of free disk space
|
||||
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);
|
||||
Program.Exit(ERROR_INSTALL_FAILURE);
|
||||
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);
|
||||
App.Terminate(ERROR_INSTALL_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -518,9 +518,9 @@ namespace Bloxstrap
|
||||
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
|
||||
Directory.Delete(oldVersionFolder, true);
|
||||
@ -529,7 +529,7 @@ namespace Bloxstrap
|
||||
|
||||
Dialog.CancelEnabled = false;
|
||||
|
||||
Program.Settings.VersionGuid = VersionGuid;
|
||||
App.Settings.VersionGuid = VersionGuid;
|
||||
}
|
||||
|
||||
private async Task ApplyModifications()
|
||||
@ -545,10 +545,10 @@ namespace Bloxstrap
|
||||
if (!Directory.Exists(modFolder))
|
||||
Directory.CreateDirectory(modFolder);
|
||||
|
||||
await CheckModPreset(Program.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg");
|
||||
await CheckModPreset(Program.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(Program.Settings.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
|
||||
await CheckModPreset(App.Settings.UseOldDeathSound, @"content\sounds\ouch.ogg", "OldDeath.ogg");
|
||||
await CheckModPreset(App.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "OldCursor.png");
|
||||
await CheckModPreset(App.Settings.UseOldMouseCursor, @"content\textures\Cursors\KeyboardMouse\ArrowFarCursor.png", "OldFarCursor.png");
|
||||
await CheckModPreset(App.Settings.UseDisableAppPatch, @"ExtraContent\places\Mobile.rbxl", "");
|
||||
|
||||
await ReShade.CheckModifications();
|
||||
|
||||
@ -697,7 +697,7 @@ namespace Bloxstrap
|
||||
if (CancelFired)
|
||||
return;
|
||||
|
||||
var response = await Program.HttpClient.GetAsync(packageUrl, HttpCompletionOption.ResponseHeadersRead);
|
||||
var response = await App.HttpClient.GetAsync(packageUrl, HttpCompletionOption.ResponseHeadersRead);
|
||||
|
||||
var buffer = new byte[8192];
|
||||
|
||||
|
@ -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;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
@ -74,11 +79,8 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
|
||||
public void SetupDialog()
|
||||
{
|
||||
if (Program.IsQuiet)
|
||||
this.Hide();
|
||||
|
||||
this.Text = Program.ProjectName;
|
||||
this.Icon = Program.Settings.BootstrapperIcon.GetIcon();
|
||||
this.Text = App.ProjectName;
|
||||
this.Icon = App.Settings.BootstrapperIcon.GetIcon();
|
||||
|
||||
if (Bootstrapper is null)
|
||||
{
|
||||
@ -113,19 +115,19 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
}
|
||||
#endif
|
||||
|
||||
Program.Exit();
|
||||
App.Terminate();
|
||||
}
|
||||
|
||||
public virtual void ShowSuccess(string message)
|
||||
{
|
||||
Program.ShowMessageBox(message, MessageBoxIcon.Information);
|
||||
Program.Exit();
|
||||
App.ShowMessageBox(message, MessageBoxImage.Information);
|
||||
App.Terminate();
|
||||
}
|
||||
|
||||
public virtual void ShowError(string message)
|
||||
{
|
||||
Program.ShowMessageBox($"An error occurred while starting Roblox\n\nDetails: {message}", MessageBoxIcon.Error);
|
||||
Program.Exit(Bootstrapper.ERROR_INSTALL_FAILURE);
|
||||
App.ShowMessageBox($"An error occurred while starting Roblox\n\nDetails: {message}", MessageBoxImage.Error);
|
||||
App.Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
|
||||
}
|
||||
|
||||
public virtual void CloseDialog()
|
||||
@ -138,13 +140,13 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
|
||||
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?",
|
||||
MessageBoxIcon.Information,
|
||||
MessageBoxButtons.OKCancel
|
||||
MessageBoxImage.Information,
|
||||
MessageBoxButton.OKCancel
|
||||
);
|
||||
|
||||
if (result != DialogResult.OK)
|
||||
if (result != MessageBoxResult.OK)
|
||||
Environment.Exit(Bootstrapper.ERROR_INSTALL_USEREXIT);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
public interface IBootstrapperDialog
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
partial class LegacyDialog2009
|
||||
{
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
// windows: https://youtu.be/VpduiruysuM?t=18
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
partial class LegacyDialog2011
|
||||
{
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
@ -37,7 +40,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
Bootstrapper = bootstrapper;
|
||||
|
||||
// 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();
|
||||
SetupDialog();
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
partial class ProgressDialog
|
||||
{
|
||||
|
@ -1,4 +1,8 @@
|
||||
using Bloxstrap.Enums;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
@ -34,7 +38,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Program.Settings.Theme.GetFinal() == Theme.Dark)
|
||||
if (App.Settings.Theme.GetFinal() == Theme.Dark)
|
||||
{
|
||||
this.labelMessage.ForeColor = SystemColors.Window;
|
||||
this.buttonCancel.Image = Properties.Resources.DarkCancelButton;
|
||||
@ -44,14 +48,14 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
|
||||
Bootstrapper = bootstrapper;
|
||||
|
||||
this.IconBox.BackgroundImage = Program.Settings.BootstrapperIcon.GetBitmap();
|
||||
this.IconBox.BackgroundImage = App.Settings.BootstrapperIcon.GetBitmap();
|
||||
|
||||
SetupDialog();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -63,7 +67,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
using Bloxstrap.Enums;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
|
||||
namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
{
|
||||
@ -65,8 +68,8 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
|
||||
Dialog = new TaskDialogPage()
|
||||
{
|
||||
Icon = new TaskDialogIcon(Program.Settings.BootstrapperIcon.GetIcon()),
|
||||
Caption = Program.ProjectName,
|
||||
Icon = new TaskDialogIcon(App.Settings.BootstrapperIcon.GetIcon()),
|
||||
Caption = App.ProjectName,
|
||||
|
||||
Buttons = { TaskDialogButton.Cancel },
|
||||
ProgressBar = new TaskDialogProgressBar()
|
||||
@ -94,14 +97,14 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
TaskDialogPage successDialog = new()
|
||||
{
|
||||
Icon = TaskDialogIcon.ShieldSuccessGreenBar,
|
||||
Caption = Program.ProjectName,
|
||||
Caption = App.ProjectName,
|
||||
Heading = message,
|
||||
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 = successDialog;
|
||||
@ -119,7 +122,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
TaskDialogPage errorDialog = new()
|
||||
{
|
||||
Icon = TaskDialogIcon.Error,
|
||||
Caption = Program.ProjectName,
|
||||
Caption = App.ProjectName,
|
||||
Heading = "An error occurred while starting Roblox",
|
||||
Buttons = { TaskDialogButton.Close },
|
||||
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 = errorDialog;
|
||||
@ -158,7 +161,7 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs
|
||||
|
||||
private void VistaDialog_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Program.IsQuiet)
|
||||
if (!App.IsQuiet)
|
||||
TaskDialog.ShowDialog(Dialog);
|
||||
}
|
||||
}
|
||||
|
@ -10,14 +10,6 @@
|
||||
SizeToContent="WidthAndHeight"
|
||||
ResizeMode="NoResize"
|
||||
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">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Modification Help" VerticalAlignment="Top" FontSize="18" />
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Windows;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.Dialogs.Menu
|
||||
{
|
||||
@ -12,17 +11,6 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
public ModHelp()
|
||||
{
|
||||
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)
|
||||
|
@ -10,14 +10,6 @@
|
||||
SizeToContent="WidthAndHeight"
|
||||
ResizeMode="NoResize"
|
||||
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">
|
||||
<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"/>
|
||||
|
@ -1,7 +1,11 @@
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
@ -29,7 +33,7 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
ViewModel = new(this);
|
||||
this.DataContext = ViewModel;
|
||||
|
||||
Program.SettingsManager.ShouldSave = false;
|
||||
App.SettingsManager.ShouldSave = false;
|
||||
|
||||
this.Icon = Imaging.CreateBitmapSourceFromHIcon(
|
||||
Properties.Resources.IconBloxstrap_ico.Handle,
|
||||
@ -37,7 +41,7 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
BitmapSizeOptions.FromEmptyOptions()
|
||||
);
|
||||
|
||||
this.Title = Program.ProjectName;
|
||||
this.Title = App.ProjectName;
|
||||
|
||||
// just in case i guess?
|
||||
if (!Environment.Is64BitOperatingSystem)
|
||||
@ -48,10 +52,10 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
{
|
||||
string theme = "Light";
|
||||
|
||||
if (Program.Settings.Theme.GetFinal() == Theme.Dark)
|
||||
if (App.Settings.Theme.GetFinal() == Theme.Dark)
|
||||
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)
|
||||
@ -76,11 +80,9 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
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 (result == System.Windows.Forms.DialogResult.OK)
|
||||
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
ViewModel.InstallLocation = dialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
@ -88,7 +90,7 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
private void ButtonPreview_Click(object sender, EventArgs e)
|
||||
{
|
||||
//this.Visible = false;
|
||||
Program.Settings.BootstrapperStyle.Show();
|
||||
App.Settings.BootstrapperStyle.Show();
|
||||
//this.Visible = true;
|
||||
}
|
||||
|
||||
@ -103,7 +105,7 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -126,42 +128,42 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
}
|
||||
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;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Program.ShowMessageBox(ex.Message, MessageBoxIcon.Error);
|
||||
App.ShowMessageBox(ex.Message, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Program.IsFirstRun)
|
||||
if (App.IsFirstRun)
|
||||
{
|
||||
// this will be set in the registry after first install
|
||||
Program.BaseDirectory = installLocation;
|
||||
App.BaseDirectory = installLocation;
|
||||
}
|
||||
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("OldInstallLocation", Program.BaseDirectory);
|
||||
registryKey.SetValue("OldInstallLocation", App.BaseDirectory);
|
||||
}
|
||||
|
||||
// preserve settings
|
||||
// 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;
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public string BloxstrapVersion { get; } = $"Version {Program.Version}";
|
||||
public string BloxstrapVersion { get; } = $"Version {App.Version}";
|
||||
|
||||
#region Integrations
|
||||
public bool DRPEnabled
|
||||
{
|
||||
get => Program.Settings.UseDiscordRichPresence;
|
||||
get => App.Settings.UseDiscordRichPresence;
|
||||
set
|
||||
{
|
||||
// if user wants discord rpc, auto-enable buttons by default
|
||||
_window.CheckBoxDRPButtons.IsChecked = value;
|
||||
Program.Settings.UseDiscordRichPresence = value;
|
||||
App.Settings.UseDiscordRichPresence = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DRPButtons
|
||||
{
|
||||
get => !Program.Settings.HideRPCButtons;
|
||||
set => Program.Settings.HideRPCButtons = !value;
|
||||
get => !App.Settings.HideRPCButtons;
|
||||
set => App.Settings.HideRPCButtons = !value;
|
||||
}
|
||||
|
||||
public bool RFUEnabled
|
||||
{
|
||||
get => Program.Settings.RFUEnabled;
|
||||
get => App.Settings.RFUEnabled;
|
||||
set
|
||||
{
|
||||
// if user wants to use rbxfpsunlocker, auto-enable autoclosing by default
|
||||
_window.CheckBoxRFUAutoclose.IsChecked = value;
|
||||
Program.Settings.RFUEnabled = value;
|
||||
App.Settings.RFUEnabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool RFUAutoclose
|
||||
{
|
||||
get => Program.Settings.RFUAutoclose;
|
||||
set => Program.Settings.RFUAutoclose = value;
|
||||
get => App.Settings.RFUAutoclose;
|
||||
set => App.Settings.RFUAutoclose = value;
|
||||
}
|
||||
|
||||
public bool UseReShade
|
||||
{
|
||||
get => Program.Settings.UseReShade;
|
||||
get => App.Settings.UseReShade;
|
||||
set
|
||||
{
|
||||
// if user wants to use reshade, auto-enable use of extravi's presets by default
|
||||
_window.CheckBoxUseReShadeExtraviPresets.IsChecked = value;
|
||||
Program.Settings.UseReShade = value;
|
||||
App.Settings.UseReShade = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseReShadeExtraviPresets
|
||||
{
|
||||
get => Program.Settings.UseReShadeExtraviPresets;
|
||||
set => Program.Settings.UseReShadeExtraviPresets = value;
|
||||
get => App.Settings.UseReShadeExtraviPresets;
|
||||
set => App.Settings.UseReShadeExtraviPresets = value;
|
||||
}
|
||||
|
||||
public bool ReShadeFolderButtonEnabled { get; } = !Program.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 bool ReShadeFolderButtonEnabled { get; } = !App.IsFirstRun;
|
||||
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
|
||||
|
||||
#region Modifications
|
||||
public bool ModOldDeathSound
|
||||
{
|
||||
get => Program.Settings.UseOldDeathSound;
|
||||
set => Program.Settings.UseOldDeathSound = value;
|
||||
get => App.Settings.UseOldDeathSound;
|
||||
set => App.Settings.UseOldDeathSound = value;
|
||||
}
|
||||
|
||||
public bool ModOldMouseCursor
|
||||
{
|
||||
get => Program.Settings.UseOldMouseCursor;
|
||||
set => Program.Settings.UseOldMouseCursor = value;
|
||||
get => App.Settings.UseOldMouseCursor;
|
||||
set => App.Settings.UseOldMouseCursor = value;
|
||||
}
|
||||
|
||||
public bool ModDisableAppPatch
|
||||
{
|
||||
get => Program.Settings.UseDisableAppPatch;
|
||||
set => Program.Settings.UseDisableAppPatch = value;
|
||||
get => App.Settings.UseDisableAppPatch;
|
||||
set => App.Settings.UseDisableAppPatch = value;
|
||||
}
|
||||
|
||||
public bool ModFolderButtonEnabled { get; } = !Program.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 bool ModFolderButtonEnabled { get; } = !App.IsFirstRun;
|
||||
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
|
||||
|
||||
#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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
get => channels;
|
||||
@ -307,11 +309,11 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
public string Channel
|
||||
{
|
||||
get => Program.Settings.Channel;
|
||||
get => App.Settings.Channel;
|
||||
set
|
||||
{
|
||||
Task.Run(() => GetChannelInfo(value));
|
||||
Program.Settings.Channel = value;
|
||||
App.Settings.Channel = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,8 +330,8 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
public bool PromptChannelChange
|
||||
{
|
||||
get => Program.Settings.PromptChannelChange;
|
||||
set => Program.Settings.PromptChannelChange = value;
|
||||
get => App.Settings.PromptChannelChange;
|
||||
set => App.Settings.PromptChannelChange = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -343,10 +345,10 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
public string Theme
|
||||
{
|
||||
get => Themes.FirstOrDefault(x => x.Value == Program.Settings.Theme).Key;
|
||||
get => Themes.FirstOrDefault(x => x.Value == App.Settings.Theme).Key;
|
||||
set
|
||||
{
|
||||
Program.Settings.Theme = Themes[value];
|
||||
App.Settings.Theme = Themes[value];
|
||||
_window.SetTheme();
|
||||
}
|
||||
}
|
||||
@ -361,8 +363,8 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
public string Dialog
|
||||
{
|
||||
get => Dialogs.FirstOrDefault(x => x.Value == Program.Settings.BootstrapperStyle).Key;
|
||||
set => Program.Settings.BootstrapperStyle = Dialogs[value];
|
||||
get => Dialogs.FirstOrDefault(x => x.Value == App.Settings.BootstrapperStyle).Key;
|
||||
set => App.Settings.BootstrapperStyle = Dialogs[value];
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<string, BootstrapperIcon> Icons { get; set; } = new Dictionary<string, BootstrapperIcon>()
|
||||
@ -379,29 +381,29 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
|
||||
public string Icon
|
||||
{
|
||||
get => Icons.FirstOrDefault(x => x.Value == Program.Settings.BootstrapperIcon).Key;
|
||||
set => Program.Settings.BootstrapperIcon = Icons[value];
|
||||
get => Icons.FirstOrDefault(x => x.Value == App.Settings.BootstrapperIcon).Key;
|
||||
set => App.Settings.BootstrapperIcon = Icons[value];
|
||||
}
|
||||
|
||||
public bool CreateDesktopIcon
|
||||
{
|
||||
get => Program.Settings.CreateDesktopIcon;
|
||||
set => Program.Settings.CreateDesktopIcon = value;
|
||||
get => App.Settings.CreateDesktopIcon;
|
||||
set => App.Settings.CreateDesktopIcon = value;
|
||||
}
|
||||
|
||||
public bool CheckForUpdates
|
||||
{
|
||||
get => Program.Settings.CheckForUpdates;
|
||||
set => Program.Settings.CheckForUpdates = value;
|
||||
get => App.Settings.CheckForUpdates;
|
||||
set => App.Settings.CheckForUpdates = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public string ConfirmButtonText { get; } = Program.IsFirstRun ? "Install" : "Save";
|
||||
public string ConfirmButtonText { get; } = App.IsFirstRun ? "Install" : "Save";
|
||||
|
||||
public PreferencesViewModel(Preferences window)
|
||||
{
|
||||
_window = window;
|
||||
Task.Run(() => GetChannelInfo(Program.Settings.Channel));
|
||||
Task.Run(() => GetChannelInfo(App.Settings.Channel));
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string? name = null)
|
||||
@ -414,7 +416,7 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
ChannelInfo = "Getting latest version info, please wait...\n";
|
||||
|
||||
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}";
|
||||
}
|
||||
|
@ -10,14 +10,6 @@
|
||||
SizeToContent="WidthAndHeight"
|
||||
ResizeMode="NoResize"
|
||||
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">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="ReShade Help" VerticalAlignment="Top" FontSize="18" />
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Windows;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.Dialogs.Menu
|
||||
{
|
||||
@ -12,17 +11,6 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
public ReShadeHelp()
|
||||
{
|
||||
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)
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace Bloxstrap.Enums
|
||||
using System.Drawing;
|
||||
|
||||
namespace Bloxstrap.Enums
|
||||
{
|
||||
public enum BootstrapperIcon
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
using Bloxstrap.Dialogs.BootstrapperDialogs;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Bloxstrap.Dialogs.BootstrapperDialogs;
|
||||
|
||||
namespace Bloxstrap.Enums
|
||||
{
|
||||
@ -36,14 +38,8 @@ namespace Bloxstrap.Enums
|
||||
break;
|
||||
}
|
||||
|
||||
if (bootstrapper is null)
|
||||
{
|
||||
if (!App.IsQuiet)
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.Run(dialog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.Threading.Tasks;
|
||||
|
||||
using Bloxstrap.Models;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
@ -55,7 +60,7 @@ namespace Bloxstrap.Helpers
|
||||
|
||||
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)
|
||||
{
|
||||
@ -75,7 +80,7 @@ namespace Bloxstrap.Helpers
|
||||
string channelUrl = BuildBaseUrl(channel);
|
||||
|
||||
// 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))
|
||||
{
|
||||
string lastModified = values.First();
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
{
|
||||
@ -8,7 +9,7 @@ namespace Bloxstrap.Helpers
|
||||
// so these can safely be called before initialization
|
||||
public static string LocalAppData { get => Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); }
|
||||
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 Downloads { get; private set; } = "";
|
||||
@ -18,7 +19,7 @@ namespace Bloxstrap.Helpers
|
||||
public static string Updates { 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); }
|
||||
|
||||
@ -32,7 +33,7 @@ namespace Bloxstrap.Helpers
|
||||
Updates = Path.Combine(Base, "Updates");
|
||||
ReShade = Path.Combine(Base, "ReShade");
|
||||
|
||||
App = Path.Combine(Base, $"{Program.ProjectName}.exe");
|
||||
Application = Path.Combine(Base, $"{App.ProjectName}.exe");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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()
|
||||
{
|
||||
|
@ -1,7 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Bloxstrap.Models;
|
||||
|
||||
@ -40,7 +41,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
if (process.MainModule is null || process.MainModule.FileName is null)
|
||||
continue;
|
||||
|
||||
if (!process.MainModule.FileName.Contains(Program.BaseDirectory))
|
||||
if (!process.MainModule.FileName.Contains(App.BaseDirectory))
|
||||
continue;
|
||||
|
||||
process.Kill();
|
||||
@ -52,14 +53,14 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
|
||||
public static async Task CheckInstall()
|
||||
{
|
||||
if (Program.BaseDirectory is null)
|
||||
if (App.BaseDirectory is null)
|
||||
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 settingsLocation = Path.Combine(folderLocation, "settings");
|
||||
|
||||
if (!Program.Settings.RFUEnabled)
|
||||
if (!App.Settings.RFUEnabled)
|
||||
{
|
||||
if (Directory.Exists(folderLocation))
|
||||
{
|
||||
@ -82,7 +83,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
if (File.Exists(fileLocation))
|
||||
{
|
||||
// no new release published, return
|
||||
if (Program.Settings.RFUVersion == releaseInfo.TagName)
|
||||
if (App.Settings.RFUVersion == releaseInfo.TagName)
|
||||
return;
|
||||
|
||||
CheckIfRunning();
|
||||
@ -92,7 +93,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
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 ZipArchive archive = new(zipStream);
|
||||
@ -103,7 +104,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
if (!File.Exists(settingsLocation))
|
||||
await File.WriteAllTextAsync(settingsLocation, Settings);
|
||||
|
||||
Program.Settings.RFUVersion = releaseInfo.TagName;
|
||||
App.Settings.RFUVersion = releaseInfo.TagName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Bloxstrap.Models;
|
||||
|
||||
@ -65,7 +69,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
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 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
|
||||
|
||||
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
|
||||
if (!File.Exists(modFolderConfigPath))
|
||||
@ -172,7 +176,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
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 ZipArchive archive = new(zipStream);
|
||||
@ -273,7 +277,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
foreach (string name in ExtraviPresetsShaders)
|
||||
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 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, "Presets"));
|
||||
|
||||
if (!Program.Settings.UseReShadeExtraviPresets)
|
||||
if (!App.Settings.UseReShadeExtraviPresets)
|
||||
{
|
||||
UninstallExtraviPresets();
|
||||
Program.Settings.ExtraviPresetsVersion = "";
|
||||
App.Settings.ExtraviPresetsVersion = "";
|
||||
}
|
||||
|
||||
if (!Program.Settings.UseReShade)
|
||||
if (!App.Settings.UseReShade)
|
||||
{
|
||||
Debug.WriteLine("[ReShade] Uninstalling ReShade...");
|
||||
|
||||
@ -334,7 +338,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
File.Delete(injectorLocation);
|
||||
File.Delete(ConfigLocation);
|
||||
|
||||
Program.Settings.ReShadeConfigVersion = "";
|
||||
App.Settings.ReShadeConfigVersion = "";
|
||||
|
||||
DeleteShaders("Stock");
|
||||
|
||||
@ -361,7 +365,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
|
||||
// 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
|
||||
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;
|
||||
|
||||
if (shouldFetchReShade)
|
||||
@ -369,7 +373,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
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 ZipArchive archive = new(zipStream);
|
||||
archive.ExtractToDirectory(Directories.Modifications, true);
|
||||
@ -381,15 +385,15 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
await DownloadConfig();
|
||||
|
||||
if (versionManifest is not null)
|
||||
Program.Settings.ReShadeConfigVersion = versionManifest.ConfigFile;
|
||||
App.Settings.ReShadeConfigVersion = versionManifest.ConfigFile;
|
||||
}
|
||||
|
||||
await DownloadShaders("Stock");
|
||||
|
||||
if (Program.Settings.UseReShadeExtraviPresets && Program.Settings.ExtraviPresetsVersion != versionManifest!.Presets)
|
||||
if (App.Settings.UseReShadeExtraviPresets && App.Settings.ExtraviPresetsVersion != versionManifest!.Presets)
|
||||
{
|
||||
await InstallExtraviPresets();
|
||||
Program.Settings.ExtraviPresetsVersion = versionManifest.Presets;
|
||||
App.Settings.ExtraviPresetsVersion = versionManifest.Presets;
|
||||
}
|
||||
|
||||
SynchronizeConfigFile();
|
||||
|
@ -1,6 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Windows;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
@ -36,7 +40,7 @@ namespace Bloxstrap.Helpers
|
||||
key = keyvalPair[0];
|
||||
val = keyvalPair[1];
|
||||
|
||||
if (!UriKeyArgMap.ContainsKey(key) || String.IsNullOrEmpty(val))
|
||||
if (!UriKeyArgMap.ContainsKey(key) || string.IsNullOrEmpty(val))
|
||||
continue;
|
||||
|
||||
if (key == "launchmode" && val == "play")
|
||||
@ -47,17 +51,17 @@ namespace Bloxstrap.Helpers
|
||||
|
||||
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(
|
||||
$"{Program.ProjectName} was launched with the Roblox build channel set to {val}, however your current preferred channel is {Program.Settings.Channel}.\n\n" +
|
||||
$"Would you like to switch channels from {Program.Settings.Channel} to {val}?",
|
||||
MessageBoxIcon.Question,
|
||||
MessageBoxButtons.YesNo
|
||||
MessageBoxResult result = !App.Settings.PromptChannelChange ? MessageBoxResult.Yes : App.ShowMessageBox(
|
||||
$"{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 {App.Settings.Channel} to {val}?",
|
||||
MessageBoxImage.Question,
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
if (result == DialogResult.Yes)
|
||||
Program.Settings.Channel = val;
|
||||
if (result == MessageBoxResult.Yes)
|
||||
App.Settings.Channel = val;
|
||||
}
|
||||
|
||||
// we'll set the arg when launching
|
||||
|
@ -1,7 +1,9 @@
|
||||
// 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.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bloxstrap.Helpers.RSMM
|
||||
{
|
||||
@ -49,7 +51,7 @@ namespace Bloxstrap.Helpers.RSMM
|
||||
public static async Task<PackageManifest> Get(string versionGuid)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
// 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
|
||||
{
|
||||
public class SystemEvent : EventWaitHandle
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
using Bloxstrap.Dialogs.Menu;
|
||||
|
||||
@ -9,55 +11,55 @@ namespace Bloxstrap.Helpers
|
||||
{
|
||||
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;
|
||||
|
||||
bool isAutoUpgrade = Environment.ProcessPath.StartsWith(Directories.Updates);
|
||||
|
||||
// if downloaded version doesn't match, replace installed version with downloaded version
|
||||
FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath);
|
||||
FileVersionInfo installedVersionInfo = FileVersionInfo.GetVersionInfo(Directories.App);
|
||||
FileVersionInfo installedVersionInfo = FileVersionInfo.GetVersionInfo(Directories.Application);
|
||||
|
||||
if (installedVersionInfo.ProductVersion == currentVersionInfo.ProductVersion)
|
||||
return;
|
||||
|
||||
|
||||
DialogResult result;
|
||||
MessageBoxResult result;
|
||||
|
||||
// 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
|
||||
{
|
||||
result = Program.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?",
|
||||
MessageBoxIcon.Question,
|
||||
MessageBoxButtons.YesNo
|
||||
result = App.ShowMessageBox(
|
||||
$"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?",
|
||||
MessageBoxImage.Question,
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (result != DialogResult.Yes)
|
||||
if (result != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
File.Delete(Directories.App);
|
||||
File.Copy(Environment.ProcessPath, Directories.App);
|
||||
File.Delete(Directories.Application);
|
||||
File.Copy(Environment.ProcessPath, Directories.Application);
|
||||
|
||||
Bootstrapper.Register();
|
||||
|
||||
if (Program.IsQuiet || isAutoUpgrade)
|
||||
if (App.IsQuiet || isAutoUpgrade)
|
||||
return;
|
||||
|
||||
Program.ShowMessageBox(
|
||||
$"{Program.ProjectName} has been updated to v{currentVersionInfo.ProductVersion}",
|
||||
MessageBoxIcon.Information,
|
||||
MessageBoxButtons.OK
|
||||
App.ShowMessageBox(
|
||||
$"{App.ProjectName} has been updated to v{currentVersionInfo.ProductVersion}",
|
||||
MessageBoxImage.Information,
|
||||
MessageBoxButton.OK
|
||||
);
|
||||
|
||||
new Preferences().ShowDialog();
|
||||
Program.Exit();
|
||||
App.Terminate();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
{
|
||||
@ -33,7 +35,7 @@ namespace Bloxstrap.Helpers
|
||||
{
|
||||
try
|
||||
{
|
||||
string json = await Program.HttpClient.GetStringAsync(url);
|
||||
string json = await App.HttpClient.GetStringAsync(url);
|
||||
return JsonSerializer.Deserialize<T>(json);
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bloxstrap.Helpers
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
|
7
Bloxstrap/Properties/launchSettings.json
Normal file
7
Bloxstrap/Properties/launchSettings.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Bloxstrap": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
using Bloxstrap.Models;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user