diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index fb79aa2..2397ab0 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -14,10 +14,9 @@ using System.Windows.Threading; using Microsoft.Win32; using Bloxstrap.Dialogs; -using Bloxstrap.Enums; -using Bloxstrap.Helpers; -using Bloxstrap.Integrations; +using Bloxstrap.Extensions; using Bloxstrap.Models; +using Bloxstrap.Singletons; using Bloxstrap.Views; namespace Bloxstrap @@ -240,7 +239,7 @@ namespace Bloxstrap { if (LaunchArgs[0].StartsWith("roblox-player:")) { - commandLine = Protocol.ParseUri(LaunchArgs[0]); + commandLine = ProtocolHandler.ParseUri(LaunchArgs[0]); } else if (LaunchArgs[0].StartsWith("roblox:")) { diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 091afb7..7361a18 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -13,10 +13,10 @@ using System.Windows; using Microsoft.Win32; using Bloxstrap.Dialogs; -using Bloxstrap.Helpers; -using Bloxstrap.Helpers.RSMM; -using Bloxstrap.Models; using Bloxstrap.Integrations; +using Bloxstrap.Models; +using Bloxstrap.Singletons; +using Bloxstrap.Tools; namespace Bloxstrap { @@ -473,8 +473,8 @@ 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.Application); - Protocol.Register("roblox-player", "Roblox", Directories.Application); + ProtocolHandler.Register("roblox", "Roblox", Directories.Application); + ProtocolHandler.Register("roblox-player", "Roblox", Directories.Application); // in case the user is reinstalling if (File.Exists(Directories.Application) && App.IsFirstRun) @@ -612,8 +612,8 @@ namespace Bloxstrap RegistryKey? bootstrapperKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\roblox-player"); if (bootstrapperKey is null) { - Protocol.Unregister("roblox"); - Protocol.Unregister("roblox-player"); + ProtocolHandler.Unregister("roblox"); + ProtocolHandler.Unregister("roblox-player"); } else { @@ -621,8 +621,8 @@ namespace Bloxstrap string bootstrapperLocation = (string?)bootstrapperKey.GetValue("InstallLocation") + "RobloxPlayerLauncher.exe"; - Protocol.Register("roblox", "Roblox", bootstrapperLocation); - Protocol.Register("roblox-player", "Roblox", bootstrapperLocation); + ProtocolHandler.Register("roblox", "Roblox", bootstrapperLocation); + ProtocolHandler.Register("roblox-player", "Roblox", bootstrapperLocation); } try diff --git a/Bloxstrap/Dialogs/BootstrapperDialogForm.cs b/Bloxstrap/Dialogs/BootstrapperDialogForm.cs index aad5cc6..64e5c5f 100644 --- a/Bloxstrap/Dialogs/BootstrapperDialogForm.cs +++ b/Bloxstrap/Dialogs/BootstrapperDialogForm.cs @@ -1,10 +1,8 @@ using System; -using System.Threading.Tasks; using System.Windows; using System.Windows.Forms; -using Bloxstrap.Enums; -using Bloxstrap.Helpers; +using Bloxstrap.Extensions; namespace Bloxstrap.Dialogs { diff --git a/Bloxstrap/Dialogs/FluentDialog.xaml.cs b/Bloxstrap/Dialogs/FluentDialog.xaml.cs index a9130ef..ff65b08 100644 --- a/Bloxstrap/Dialogs/FluentDialog.xaml.cs +++ b/Bloxstrap/Dialogs/FluentDialog.xaml.cs @@ -3,7 +3,7 @@ using System.Windows; using System.Windows.Forms; using Bloxstrap.Enums; -using Bloxstrap.Helpers.Extensions; +using Bloxstrap.Extensions; using Bloxstrap.ViewModels; using Wpf.Ui.Appearance; diff --git a/Bloxstrap/Dialogs/LegacyDialog2011.cs b/Bloxstrap/Dialogs/LegacyDialog2011.cs index 71d5390..54ada74 100644 --- a/Bloxstrap/Dialogs/LegacyDialog2011.cs +++ b/Bloxstrap/Dialogs/LegacyDialog2011.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -using Bloxstrap.Enums; +using Bloxstrap.Extensions; namespace Bloxstrap.Dialogs { diff --git a/Bloxstrap/Dialogs/ProgressDialog.cs b/Bloxstrap/Dialogs/ProgressDialog.cs index 7a9e88a..da62dd1 100644 --- a/Bloxstrap/Dialogs/ProgressDialog.cs +++ b/Bloxstrap/Dialogs/ProgressDialog.cs @@ -3,7 +3,7 @@ using System.Drawing; using System.Windows.Forms; using Bloxstrap.Enums; -using Bloxstrap.Helpers.Extensions; +using Bloxstrap.Extensions; namespace Bloxstrap.Dialogs { diff --git a/Bloxstrap/Dialogs/VistaDialog.cs b/Bloxstrap/Dialogs/VistaDialog.cs index 8d9211f..738f954 100644 --- a/Bloxstrap/Dialogs/VistaDialog.cs +++ b/Bloxstrap/Dialogs/VistaDialog.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -using Bloxstrap.Enums; +using Bloxstrap.Extensions; namespace Bloxstrap.Dialogs { diff --git a/Bloxstrap/Helpers/Directories.cs b/Bloxstrap/Directories.cs similarity index 93% rename from Bloxstrap/Helpers/Directories.cs rename to Bloxstrap/Directories.cs index ee42591..877c786 100644 --- a/Bloxstrap/Helpers/Directories.cs +++ b/Bloxstrap/Directories.cs @@ -1,9 +1,9 @@ using System; using System.IO; -namespace Bloxstrap.Helpers +namespace Bloxstrap { - class Directories + static class Directories { // note that these are directories that aren't tethered to the basedirectory // so these can safely be called before initialization @@ -21,7 +21,7 @@ namespace Bloxstrap.Helpers public static string Application { get; private set; } = ""; - public static bool Initialized => String.IsNullOrEmpty(Base); + public static bool Initialized => string.IsNullOrEmpty(Base); public static void Initialize(string baseDirectory) { diff --git a/Bloxstrap/Enums/BootstrapperIcon.cs b/Bloxstrap/Enums/BootstrapperIcon.cs index d0b938e..4a44b87 100644 --- a/Bloxstrap/Enums/BootstrapperIcon.cs +++ b/Bloxstrap/Enums/BootstrapperIcon.cs @@ -1,10 +1,4 @@ -using System; -using System.Drawing; -using System.IO; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace Bloxstrap.Enums +namespace Bloxstrap.Enums { public enum BootstrapperIcon { @@ -18,44 +12,4 @@ namespace Bloxstrap.Enums Icon2022, IconCustom } - - public static class BootstrapperIconEx - { - // small note on handling icon sizes - // i'm using multisize icon packs here with sizes 16, 24, 32, 48, 64 and 128 - // use this for generating multisize packs: https://www.aconvert.com/icon/ - - public static Icon GetIcon(this BootstrapperIcon icon) - { - // load the custom icon file - if (icon == BootstrapperIcon.IconCustom) - { - Icon? customIcon = null; - - try - { - customIcon = new Icon(App.Settings.Prop.BootstrapperIconCustomLocation); - } - catch (Exception ex) - { - App.Logger.WriteLine($"[BootstrapperIconEx::GetIcon] Failed to load custom icon! {ex}"); - } - - return customIcon ?? Properties.Resources.IconBloxstrap; - } - - return icon switch - { - BootstrapperIcon.IconBloxstrap => Properties.Resources.IconBloxstrap, - BootstrapperIcon.Icon2009 => Properties.Resources.Icon2009, - BootstrapperIcon.Icon2011 => Properties.Resources.Icon2011, - BootstrapperIcon.IconEarly2015 => Properties.Resources.IconEarly2015, - BootstrapperIcon.IconLate2015 => Properties.Resources.IconLate2015, - BootstrapperIcon.Icon2017 => Properties.Resources.Icon2017, - BootstrapperIcon.Icon2019 => Properties.Resources.Icon2019, - BootstrapperIcon.Icon2022 => Properties.Resources.Icon2022, - _ => Properties.Resources.IconBloxstrap - }; - } - } } diff --git a/Bloxstrap/Enums/BootstrapperStyle.cs b/Bloxstrap/Enums/BootstrapperStyle.cs index 555d1f1..69aa77a 100644 --- a/Bloxstrap/Enums/BootstrapperStyle.cs +++ b/Bloxstrap/Enums/BootstrapperStyle.cs @@ -1,8 +1,4 @@ -using System.Windows.Forms; - -using Bloxstrap.Dialogs; - -namespace Bloxstrap.Enums +namespace Bloxstrap.Enums { public enum BootstrapperStyle { @@ -12,20 +8,4 @@ namespace Bloxstrap.Enums ProgressDialog, FluentDialog } - - public static class BootstrapperStyleEx - { - public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyle) - { - return bootstrapperStyle switch - { - BootstrapperStyle.VistaDialog => new VistaDialog(), - BootstrapperStyle.LegacyDialog2009 => new LegacyDialog2009(), - BootstrapperStyle.LegacyDialog2011 => new LegacyDialog2011(), - BootstrapperStyle.ProgressDialog => new ProgressDialog(), - BootstrapperStyle.FluentDialog => new FluentDialog(), - _ => new FluentDialog() - }; - } - } } diff --git a/Bloxstrap/Enums/Theme.cs b/Bloxstrap/Enums/Theme.cs index 4e34f5a..2f76cb4 100644 --- a/Bloxstrap/Enums/Theme.cs +++ b/Bloxstrap/Enums/Theme.cs @@ -1,6 +1,4 @@ -using Microsoft.Win32; - -namespace Bloxstrap.Enums +namespace Bloxstrap.Enums { public enum Theme { @@ -8,25 +6,4 @@ namespace Bloxstrap.Enums Light, Dark } - - public static class DialogThemeEx - { - public static Theme GetFinal(this Theme dialogTheme) - { - if (dialogTheme != Theme.Default) - return dialogTheme; - - RegistryKey? key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"); - - if (key is not null) - { - var value = key.GetValue("AppsUseLightTheme"); - - if (value is not null && (int)value == 0) - return Theme.Dark; - } - - return Theme.Light; - } - } } diff --git a/Bloxstrap/Extensions/BootstrapperIconEx.cs b/Bloxstrap/Extensions/BootstrapperIconEx.cs new file mode 100644 index 0000000..5b8721b --- /dev/null +++ b/Bloxstrap/Extensions/BootstrapperIconEx.cs @@ -0,0 +1,47 @@ +using System; +using System.Drawing; + +using Bloxstrap.Enums; + +namespace Bloxstrap.Extensions +{ + static class BootstrapperIconEx + { + // small note on handling icon sizes + // i'm using multisize icon packs here with sizes 16, 24, 32, 48, 64 and 128 + // use this for generating multisize packs: https://www.aconvert.com/icon/ + + public static Icon GetIcon(this BootstrapperIcon icon) + { + // load the custom icon file + if (icon == BootstrapperIcon.IconCustom) + { + Icon? customIcon = null; + + try + { + customIcon = new Icon(App.Settings.Prop.BootstrapperIconCustomLocation); + } + catch (Exception ex) + { + App.Logger.WriteLine($"[BootstrapperIconEx::GetIcon] Failed to load custom icon! {ex}"); + } + + return customIcon ?? Properties.Resources.IconBloxstrap; + } + + return icon switch + { + BootstrapperIcon.IconBloxstrap => Properties.Resources.IconBloxstrap, + BootstrapperIcon.Icon2009 => Properties.Resources.Icon2009, + BootstrapperIcon.Icon2011 => Properties.Resources.Icon2011, + BootstrapperIcon.IconEarly2015 => Properties.Resources.IconEarly2015, + BootstrapperIcon.IconLate2015 => Properties.Resources.IconLate2015, + BootstrapperIcon.Icon2017 => Properties.Resources.Icon2017, + BootstrapperIcon.Icon2019 => Properties.Resources.Icon2019, + BootstrapperIcon.Icon2022 => Properties.Resources.Icon2022, + _ => Properties.Resources.IconBloxstrap + }; + } + } +} diff --git a/Bloxstrap/Extensions/BootstrapperStyleEx.cs b/Bloxstrap/Extensions/BootstrapperStyleEx.cs new file mode 100644 index 0000000..0a6ef0b --- /dev/null +++ b/Bloxstrap/Extensions/BootstrapperStyleEx.cs @@ -0,0 +1,21 @@ +using Bloxstrap.Dialogs; +using Bloxstrap.Enums; + +namespace Bloxstrap.Extensions +{ + static class BootstrapperStyleEx + { + public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyle) + { + return bootstrapperStyle switch + { + BootstrapperStyle.VistaDialog => new VistaDialog(), + BootstrapperStyle.LegacyDialog2009 => new LegacyDialog2009(), + BootstrapperStyle.LegacyDialog2011 => new LegacyDialog2011(), + BootstrapperStyle.ProgressDialog => new ProgressDialog(), + BootstrapperStyle.FluentDialog => new FluentDialog(), + _ => new FluentDialog() + }; + } + } +} diff --git a/Bloxstrap/Helpers/Extensions/IconEx.cs b/Bloxstrap/Extensions/IconEx.cs similarity index 93% rename from Bloxstrap/Helpers/Extensions/IconEx.cs rename to Bloxstrap/Extensions/IconEx.cs index 5144c5a..bdb1ddd 100644 --- a/Bloxstrap/Helpers/Extensions/IconEx.cs +++ b/Bloxstrap/Extensions/IconEx.cs @@ -3,7 +3,7 @@ using System.IO; using System.Windows.Media.Imaging; using System.Windows.Media; -namespace Bloxstrap.Helpers.Extensions +namespace Bloxstrap.Extensions { public static class IconEx { diff --git a/Bloxstrap/Extensions/ThemeEx.cs b/Bloxstrap/Extensions/ThemeEx.cs new file mode 100644 index 0000000..57ab955 --- /dev/null +++ b/Bloxstrap/Extensions/ThemeEx.cs @@ -0,0 +1,26 @@ +using Microsoft.Win32; +using Bloxstrap.Enums; + +namespace Bloxstrap.Extensions +{ + public static class ThemeEx + { + public static Theme GetFinal(this Theme dialogTheme) + { + if (dialogTheme != Theme.Default) + return dialogTheme; + + RegistryKey? key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"); + + if (key is not null) + { + var value = key.GetValue("AppsUseLightTheme"); + + if (value is not null && (int)value == 0) + return Theme.Dark; + } + + return Theme.Light; + } + } +} diff --git a/Bloxstrap/Helpers/GameActivityWatcher.cs b/Bloxstrap/GameActivityWatcher.cs similarity index 99% rename from Bloxstrap/Helpers/GameActivityWatcher.cs rename to Bloxstrap/GameActivityWatcher.cs index 45f15be..523f6db 100644 --- a/Bloxstrap/Helpers/GameActivityWatcher.cs +++ b/Bloxstrap/GameActivityWatcher.cs @@ -1,13 +1,11 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -namespace Bloxstrap.Helpers +namespace Bloxstrap { public class GameActivityWatcher : IDisposable { diff --git a/Bloxstrap/Integrations/DiscordRichPresence.cs b/Bloxstrap/Integrations/DiscordRichPresence.cs index 312375b..40c4be4 100644 --- a/Bloxstrap/Integrations/DiscordRichPresence.cs +++ b/Bloxstrap/Integrations/DiscordRichPresence.cs @@ -3,14 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Bloxstrap.Helpers; -using Bloxstrap.Models.RobloxApi; - using DiscordRPC; +using Bloxstrap.Models.RobloxApi; + namespace Bloxstrap.Integrations { - class DiscordRichPresence : IDisposable + public class DiscordRichPresence : IDisposable { private readonly DiscordRpcClient _rpcClient = new("1005469189907173486"); private readonly GameActivityWatcher _activityWatcher; diff --git a/Bloxstrap/Integrations/ReShade.cs b/Bloxstrap/Integrations/ReShade.cs index ee409b9..c6a9be0 100644 --- a/Bloxstrap/Integrations/ReShade.cs +++ b/Bloxstrap/Integrations/ReShade.cs @@ -6,15 +6,14 @@ using System.IO.Compression; using System.Linq; using System.Threading.Tasks; -using Bloxstrap.Helpers; -using Bloxstrap.Models; - using IniParser; using IniParser.Model; +using Bloxstrap.Models; + namespace Bloxstrap.Integrations { - internal class ReShade + public class ReShade { // i havent even started this and i know for a fact this is gonna be a mess of an integration lol // there's a lot of nuances involved in how reshade functionality is supposed to work (shader management, config management, etc) diff --git a/Bloxstrap/Integrations/ServerNotifier.cs b/Bloxstrap/Integrations/ServerNotifier.cs index eb2e380..cd04ef6 100644 --- a/Bloxstrap/Integrations/ServerNotifier.cs +++ b/Bloxstrap/Integrations/ServerNotifier.cs @@ -3,7 +3,6 @@ using System.Net.NetworkInformation; using System.Threading.Tasks; using System.Windows.Forms; -using Bloxstrap.Helpers; using Bloxstrap.Properties; namespace Bloxstrap.Integrations diff --git a/Bloxstrap/Models/CustomIntegration.cs b/Bloxstrap/Models/CustomIntegration.cs index ece4258..d293f61 100644 --- a/Bloxstrap/Models/CustomIntegration.cs +++ b/Bloxstrap/Models/CustomIntegration.cs @@ -1,11 +1,4 @@ -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Bloxstrap.Models +namespace Bloxstrap.Models { public class CustomIntegration { diff --git a/Bloxstrap/Helpers/RSMM/Package.cs b/Bloxstrap/Models/Package.cs similarity index 63% rename from Bloxstrap/Helpers/RSMM/Package.cs rename to Bloxstrap/Models/Package.cs index bb254b7..8b6be56 100644 --- a/Bloxstrap/Helpers/RSMM/Package.cs +++ b/Bloxstrap/Models/Package.cs @@ -1,8 +1,12 @@ -// https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Utility/Package.cs +/* + * Roblox Studio Mod Manager (ProjectSrc/Utility/Package.cs) + * MIT License + * Copyright (c) 2015-present MaximumADHD +*/ -namespace Bloxstrap.Helpers.RSMM +namespace Bloxstrap.Models { - internal class Package + public class Package { public string Name { get; set; } = ""; public string Signature { get; set; } = ""; diff --git a/Bloxstrap/Helpers/RSMM/PackageManifest.cs b/Bloxstrap/Models/PackageManifest.cs similarity index 89% rename from Bloxstrap/Helpers/RSMM/PackageManifest.cs rename to Bloxstrap/Models/PackageManifest.cs index e4a8d2a..6380277 100644 --- a/Bloxstrap/Helpers/RSMM/PackageManifest.cs +++ b/Bloxstrap/Models/PackageManifest.cs @@ -1,13 +1,17 @@ -// https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Bootstrapper/PackageManifest.cs +/* + * Roblox Studio Mod Manager (ProjectSrc/Utility/PackageManifest.cs) + * MIT License + * Copyright (c) 2015-present MaximumADHD +*/ using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -namespace Bloxstrap.Helpers.RSMM +namespace Bloxstrap.Models { - internal class PackageManifest : List + public class PackageManifest : List { private PackageManifest(string data) { diff --git a/Bloxstrap/Models/RobloxApi/UniverseIdResponse.cs b/Bloxstrap/Models/RobloxApi/UniverseIdResponse.cs index 50e597f..19bb84d 100644 --- a/Bloxstrap/Models/RobloxApi/UniverseIdResponse.cs +++ b/Bloxstrap/Models/RobloxApi/UniverseIdResponse.cs @@ -3,7 +3,7 @@ namespace Bloxstrap.Models.RobloxApi { // lmao its just one property - internal class UniverseIdResponse + public class UniverseIdResponse { [JsonPropertyName("universeId")] public long UniverseId { get; set; } diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs index 95b1b8e..8d066bd 100644 --- a/Bloxstrap/Models/Settings.cs +++ b/Bloxstrap/Models/Settings.cs @@ -1,8 +1,7 @@ -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; +using System.Collections.ObjectModel; + using Bloxstrap.Enums; -using Bloxstrap.Helpers; +using Bloxstrap.Singletons; namespace Bloxstrap.Models { diff --git a/Bloxstrap/Helpers/Protocol.cs b/Bloxstrap/ProtocolHandler.cs similarity index 97% rename from Bloxstrap/Helpers/Protocol.cs rename to Bloxstrap/ProtocolHandler.cs index 70c56b3..2d6fa2d 100644 --- a/Bloxstrap/Helpers/Protocol.cs +++ b/Bloxstrap/ProtocolHandler.cs @@ -1,15 +1,14 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Text; using System.Web; using System.Windows; using Microsoft.Win32; -namespace Bloxstrap.Helpers +namespace Bloxstrap { - public class Protocol + static class ProtocolHandler { // map uri keys to command line args private static readonly IReadOnlyDictionary UriKeyArgMap = new Dictionary() @@ -112,7 +111,7 @@ namespace Bloxstrap.Helpers { Registry.CurrentUser.DeleteSubKeyTree($@"Software\Classes\{key}"); } - catch (Exception ex) + catch (Exception ex) { App.Logger.WriteLine($"[Protocol::Unregister] Failed to unregister {key}: {ex}"); } diff --git a/Bloxstrap/Helpers/ResourceHelper.cs b/Bloxstrap/ResourceHelper.cs similarity index 92% rename from Bloxstrap/Helpers/ResourceHelper.cs rename to Bloxstrap/ResourceHelper.cs index def71f9..1cd5273 100644 --- a/Bloxstrap/Helpers/ResourceHelper.cs +++ b/Bloxstrap/ResourceHelper.cs @@ -3,9 +3,9 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; -namespace Bloxstrap.Helpers +namespace Bloxstrap { - internal class ResourceHelper + static class ResourceHelper { static readonly Assembly assembly = Assembly.GetExecutingAssembly(); static readonly string[] resourceNames = assembly.GetManifestResourceNames(); diff --git a/Bloxstrap/Helpers/DeployManager.cs b/Bloxstrap/Singletons/DeployManager.cs similarity index 94% rename from Bloxstrap/Helpers/DeployManager.cs rename to Bloxstrap/Singletons/DeployManager.cs index 70e1eef..f42d4c9 100644 --- a/Bloxstrap/Helpers/DeployManager.cs +++ b/Bloxstrap/Singletons/DeployManager.cs @@ -8,7 +8,7 @@ using System.Windows; using Bloxstrap.Models; -namespace Bloxstrap.Helpers +namespace Bloxstrap.Singletons { // TODO - make this functional and into a helper instead of a singleton, this really doesn't need to be OOP @@ -33,7 +33,7 @@ namespace Bloxstrap.Helpers { get { - if (String.IsNullOrEmpty(_baseUrl)) + if (string.IsNullOrEmpty(_baseUrl)) { // check for a working accessible deployment domain foreach (string attemptedUrl in BaseUrls) @@ -55,12 +55,12 @@ namespace Bloxstrap.Helpers } } - if (String.IsNullOrEmpty(_baseUrl)) + if (string.IsNullOrEmpty(_baseUrl)) throw new Exception("Unable to find an accessible Roblox deploy mirror!"); } if (Channel == DefaultChannel) - return _baseUrl; + return _baseUrl; else return $"{_baseUrl}/channel/{Channel.ToLower()}"; } @@ -94,10 +94,10 @@ namespace Bloxstrap.Helpers // 404 = Could not find version details for binaryType. // 500 = Error while fetching version information. // either way, we throw - + App.Logger.WriteLine( - "[DeployManager::GetLastDeploy] Failed to fetch deploy info!\r\n"+ - $"\tStatus code: {deployInfoResponse.StatusCode}\r\n"+ + "[DeployManager::GetLastDeploy] Failed to fetch deploy info!\r\n" + + $"\tStatus code: {deployInfoResponse.StatusCode}\r\n" + $"\tResponse: {rawResponse}" ); @@ -163,8 +163,8 @@ namespace Bloxstrap.Helpers // this SUCKS ClientVersion defaultChannelInfo = await new DeployManager().GetLastDeploy().ConfigureAwait(false); - int defaultChannelVersion = Int32.Parse(defaultChannelInfo.Version.Split('.')[1]); - int currentChannelVersion = Int32.Parse(versionInfo.Version.Split('.')[1]); + int defaultChannelVersion = int.Parse(defaultChannelInfo.Version.Split('.')[1]); + int currentChannelVersion = int.Parse(versionInfo.Version.Split('.')[1]); if (currentChannelVersion < defaultChannelVersion) { diff --git a/Bloxstrap/Helpers/FastFlagManager.cs b/Bloxstrap/Singletons/FastFlagManager.cs similarity index 98% rename from Bloxstrap/Helpers/FastFlagManager.cs rename to Bloxstrap/Singletons/FastFlagManager.cs index ce87d3e..ff3106a 100644 --- a/Bloxstrap/Helpers/FastFlagManager.cs +++ b/Bloxstrap/Singletons/FastFlagManager.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Text.Json; -namespace Bloxstrap.Helpers +namespace Bloxstrap.Singletons { public class FastFlagManager : JsonManager> { @@ -27,8 +27,8 @@ namespace Bloxstrap.Helpers // this is one hell of a variable definition lmao public static IReadOnlyDictionary> IGMenuVersions => new Dictionary> { - { - "Default", + { + "Default", new Dictionary { { "FFlagDisableNewIGMinDUA", null }, diff --git a/Bloxstrap/Helpers/JsonManager.cs b/Bloxstrap/Singletons/JsonManager.cs similarity index 97% rename from Bloxstrap/Helpers/JsonManager.cs rename to Bloxstrap/Singletons/JsonManager.cs index ef39f9c..7f212e8 100644 --- a/Bloxstrap/Helpers/JsonManager.cs +++ b/Bloxstrap/Singletons/JsonManager.cs @@ -2,7 +2,7 @@ using System.IO; using System.Text.Json; -namespace Bloxstrap.Helpers +namespace Bloxstrap.Singletons { public class JsonManager where T : new() { @@ -16,7 +16,7 @@ namespace Bloxstrap.Helpers try { T? settings = JsonSerializer.Deserialize(File.ReadAllText(FileLocation)); - + if (settings is null) throw new ArgumentNullException("Deserialization returned null"); diff --git a/Bloxstrap/Helpers/Logger.cs b/Bloxstrap/Singletons/Logger.cs similarity index 95% rename from Bloxstrap/Helpers/Logger.cs rename to Bloxstrap/Singletons/Logger.cs index c4fd13f..97a5350 100644 --- a/Bloxstrap/Helpers/Logger.cs +++ b/Bloxstrap/Singletons/Logger.cs @@ -5,7 +5,7 @@ using System.IO; using System.Text; using System.Threading; -namespace Bloxstrap.Helpers +namespace Bloxstrap.Singletons { // https://stackoverflow.com/a/53873141/11852173 public class Logger @@ -27,7 +27,7 @@ namespace Bloxstrap.Helpers _filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read); if (_backlog.Count > 0) - WriteToLog(String.Join("\r\n", _backlog)); + WriteToLog(string.Join("\r\n", _backlog)); WriteLine($"[Logger::Logger] Initialized at {filename}"); } diff --git a/Bloxstrap/Helpers/AsyncMutex.cs b/Bloxstrap/Tools/AsyncMutex.cs similarity index 99% rename from Bloxstrap/Helpers/AsyncMutex.cs rename to Bloxstrap/Tools/AsyncMutex.cs index 3691582..fa6d137 100644 --- a/Bloxstrap/Helpers/AsyncMutex.cs +++ b/Bloxstrap/Tools/AsyncMutex.cs @@ -5,9 +5,10 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Bloxstrap.Helpers +namespace Bloxstrap.Tools { // https://gist.github.com/dfederm/35c729f6218834b764fa04c219181e4e + public sealed class AsyncMutex : IAsyncDisposable { private readonly string _name; diff --git a/Bloxstrap/Helpers/RSMM/SystemEvent.cs b/Bloxstrap/Tools/SystemEvent.cs similarity index 86% rename from Bloxstrap/Helpers/RSMM/SystemEvent.cs rename to Bloxstrap/Tools/SystemEvent.cs index 752fc28..098dc63 100644 --- a/Bloxstrap/Helpers/RSMM/SystemEvent.cs +++ b/Bloxstrap/Tools/SystemEvent.cs @@ -1,10 +1,14 @@ -// https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Utility/SystemEvent.cs +/* + * Roblox Studio Mod Manager (ProjectSrc/Utility/SystemEvent.cs) + * MIT License + * Copyright (c) 2015-present MaximumADHD +*/ using System; using System.Threading; using System.Threading.Tasks; -namespace Bloxstrap.Helpers.RSMM +namespace Bloxstrap.Tools { public class SystemEvent : EventWaitHandle { diff --git a/Bloxstrap/Helpers/Updater.cs b/Bloxstrap/Updater.cs similarity index 98% rename from Bloxstrap/Helpers/Updater.cs rename to Bloxstrap/Updater.cs index c9c1ebe..3d768e7 100644 --- a/Bloxstrap/Helpers/Updater.cs +++ b/Bloxstrap/Updater.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Bloxstrap.Properties; using Bloxstrap.Views; -namespace Bloxstrap.Helpers +namespace Bloxstrap { public class Updater { @@ -75,7 +75,7 @@ namespace Bloxstrap.Helpers } File.Copy(Environment.ProcessPath, Directories.Application); - + Bootstrapper.Register(); if (isAutoUpgrade) diff --git a/Bloxstrap/Helpers/Utilities.cs b/Bloxstrap/Utilities.cs similarity index 98% rename from Bloxstrap/Helpers/Utilities.cs rename to Bloxstrap/Utilities.cs index 2d9c285..5cce944 100644 --- a/Bloxstrap/Helpers/Utilities.cs +++ b/Bloxstrap/Utilities.cs @@ -6,9 +6,9 @@ using System.Security.Cryptography; using System.Text.Json; using System.Threading.Tasks; -namespace Bloxstrap.Helpers +namespace Bloxstrap { - public class Utilities + static class Utilities { public static bool IsDirectoryEmpty(string path) { diff --git a/Bloxstrap/ViewModels/AboutViewModel.cs b/Bloxstrap/ViewModels/AboutViewModel.cs index a8751b3..7731db3 100644 --- a/Bloxstrap/ViewModels/AboutViewModel.cs +++ b/Bloxstrap/ViewModels/AboutViewModel.cs @@ -1,8 +1,4 @@ -using System.Windows.Input; -using CommunityToolkit.Mvvm.Input; -using Bloxstrap.Helpers; - -namespace Bloxstrap.ViewModels +namespace Bloxstrap.ViewModels { public class AboutViewModel { diff --git a/Bloxstrap/ViewModels/AppearanceViewModel.cs b/Bloxstrap/ViewModels/AppearanceViewModel.cs index 818085f..d0d2185 100644 --- a/Bloxstrap/ViewModels/AppearanceViewModel.cs +++ b/Bloxstrap/ViewModels/AppearanceViewModel.cs @@ -6,11 +6,12 @@ using System.Windows.Controls; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; + using CommunityToolkit.Mvvm.Input; using Bloxstrap.Dialogs; using Bloxstrap.Enums; -using Bloxstrap.Helpers.Extensions; +using Bloxstrap.Extensions; using Bloxstrap.Views; namespace Bloxstrap.ViewModels diff --git a/Bloxstrap/ViewModels/BehaviourViewModel.cs b/Bloxstrap/ViewModels/BehaviourViewModel.cs index 9060d27..3c0c91c 100644 --- a/Bloxstrap/ViewModels/BehaviourViewModel.cs +++ b/Bloxstrap/ViewModels/BehaviourViewModel.cs @@ -1,22 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; -using Bloxstrap.Dialogs; -using Bloxstrap.Enums; -using Bloxstrap.Helpers.Extensions; -using Bloxstrap.Views; -using CommunityToolkit.Mvvm.Input; -using Wpf.Ui.Mvvm.Services; -using Wpf.Ui.Mvvm.Contracts; - -namespace Bloxstrap.ViewModels +namespace Bloxstrap.ViewModels { public class BehaviourViewModel { diff --git a/Bloxstrap/ViewModels/FluentDialogViewModel.cs b/Bloxstrap/ViewModels/FluentDialogViewModel.cs index 8429d97..fc81ba1 100644 --- a/Bloxstrap/ViewModels/FluentDialogViewModel.cs +++ b/Bloxstrap/ViewModels/FluentDialogViewModel.cs @@ -10,11 +10,11 @@ using System.Windows.Media; using CommunityToolkit.Mvvm.Input; using Bloxstrap.Dialogs; using Bloxstrap.Enums; -using Bloxstrap.Helpers.Extensions; +using Bloxstrap.Extensions; namespace Bloxstrap.ViewModels { - class FluentDialogViewModel : INotifyPropertyChanged + public class FluentDialogViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); diff --git a/Bloxstrap/ViewModels/GlobalViewModel.cs b/Bloxstrap/ViewModels/GlobalViewModel.cs index 4d50b82..0c47ef2 100644 --- a/Bloxstrap/ViewModels/GlobalViewModel.cs +++ b/Bloxstrap/ViewModels/GlobalViewModel.cs @@ -1,11 +1,6 @@ -using Bloxstrap.Helpers; +using System.Windows.Input; + using CommunityToolkit.Mvvm.Input; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Input; namespace Bloxstrap.ViewModels { diff --git a/Bloxstrap/ViewModels/InstallationViewModel.cs b/Bloxstrap/ViewModels/InstallationViewModel.cs index f72f01e..9d31922 100644 --- a/Bloxstrap/ViewModels/InstallationViewModel.cs +++ b/Bloxstrap/ViewModels/InstallationViewModel.cs @@ -8,8 +8,8 @@ using System.Windows; using System.Windows.Forms; using System.Windows.Input; using CommunityToolkit.Mvvm.Input; -using Bloxstrap.Helpers; using Bloxstrap.Models; +using Bloxstrap.Singletons; namespace Bloxstrap.ViewModels { diff --git a/Bloxstrap/ViewModels/IntegrationsViewModel.cs b/Bloxstrap/ViewModels/IntegrationsViewModel.cs index d097c9d..3f0c4b4 100644 --- a/Bloxstrap/ViewModels/IntegrationsViewModel.cs +++ b/Bloxstrap/ViewModels/IntegrationsViewModel.cs @@ -1,12 +1,12 @@ -using System.ComponentModel; +using System.Collections.ObjectModel; +using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Windows.Input; + using CommunityToolkit.Mvvm.Input; -using Bloxstrap.Helpers; using Bloxstrap.Models; -using System.Collections.ObjectModel; namespace Bloxstrap.ViewModels { diff --git a/Bloxstrap/ViewModels/MainWindowViewModel.cs b/Bloxstrap/ViewModels/MainWindowViewModel.cs index 259c3f8..cc29b5f 100644 --- a/Bloxstrap/ViewModels/MainWindowViewModel.cs +++ b/Bloxstrap/ViewModels/MainWindowViewModel.cs @@ -2,9 +2,11 @@ using System.IO; using System.Windows; using System.Windows.Input; -using Bloxstrap.Helpers; + using Microsoft.Win32; + using CommunityToolkit.Mvvm.Input; + using Wpf.Ui.Controls.Interfaces; using Wpf.Ui.Mvvm.Contracts; diff --git a/Bloxstrap/ViewModels/ModsViewModel.cs b/Bloxstrap/ViewModels/ModsViewModel.cs index c568846..81e3efd 100644 --- a/Bloxstrap/ViewModels/ModsViewModel.cs +++ b/Bloxstrap/ViewModels/ModsViewModel.cs @@ -3,9 +3,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Windows.Input; -using Bloxstrap.Helpers; + using CommunityToolkit.Mvvm.Input; +using Bloxstrap.Singletons; + namespace Bloxstrap.ViewModels { public class ModsViewModel : INotifyPropertyChanged diff --git a/Bloxstrap/Views/MainWindow.xaml.cs b/Bloxstrap/Views/MainWindow.xaml.cs index b2087b6..27771d4 100644 --- a/Bloxstrap/Views/MainWindow.xaml.cs +++ b/Bloxstrap/Views/MainWindow.xaml.cs @@ -1,11 +1,13 @@ -using System.Windows.Controls; -using System; +using System; +using System.Windows.Controls; + +using Wpf.Ui.Appearance; using Wpf.Ui.Controls.Interfaces; using Wpf.Ui.Mvvm.Contracts; -using Bloxstrap.Enums; -using Bloxstrap.ViewModels; using Wpf.Ui.Mvvm.Services; -using Wpf.Ui.Appearance; + +using Bloxstrap.Extensions; +using Bloxstrap.ViewModels; namespace Bloxstrap.Views { diff --git a/Bloxstrap/Helpers/WindowScaling.cs b/Bloxstrap/WindowScaling.cs similarity index 94% rename from Bloxstrap/Helpers/WindowScaling.cs rename to Bloxstrap/WindowScaling.cs index fe09ee0..3908587 100644 --- a/Bloxstrap/Helpers/WindowScaling.cs +++ b/Bloxstrap/WindowScaling.cs @@ -2,9 +2,9 @@ using System.Windows; using System.Windows.Forms; -namespace Bloxstrap.Helpers +namespace Bloxstrap { - public class WindowScaling + public static class WindowScaling { public static double GetFactor() {