diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index a9c4efc..7f841ee 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -151,7 +151,7 @@ namespace Bloxstrap { Logger.WriteLine(LOG_IDENT, "Running first-time install"); - BaseDirectory = Path.Combine(Directories.LocalAppData, ProjectName); + BaseDirectory = Path.Combine(Paths.LocalAppData, ProjectName); Logger.Initialize(true); if (!IsQuiet) @@ -175,7 +175,7 @@ namespace Bloxstrap Terminate(ErrorCode.ERROR_CANCELLED); } - Directories.Initialize(BaseDirectory); + Paths.Initialize(BaseDirectory); // we shouldn't save settings on the first run until the first installation is finished, // just in case the user decides to cancel the install diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 24f9db2..b19ff90 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -52,7 +52,7 @@ namespace Bloxstrap private readonly CancellationTokenSource _cancelTokenSource = new(); private static bool FreshInstall => String.IsNullOrEmpty(App.State.Prop.VersionGuid); - private static string DesktopShortcutLocation => Path.Combine(Directories.Desktop, "Play Roblox.lnk"); + private static string DesktopShortcutLocation => Path.Combine(Paths.Desktop, "Play Roblox.lnk"); private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe"); @@ -192,7 +192,7 @@ namespace Bloxstrap ClientVersion clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); _latestVersionGuid = clientVersion.VersionGuid; - _versionFolder = Path.Combine(Directories.Versions, _latestVersionGuid); + _versionFolder = Path.Combine(Paths.Versions, _latestVersionGuid); _versionPackageManifest = await PackageManifest.Get(_latestVersionGuid); } @@ -209,7 +209,7 @@ namespace Bloxstrap return; } - if (!File.Exists(Path.Combine(Directories.System, "mfplat.dll"))) + if (!File.Exists(Path.Combine(Paths.System, "mfplat.dll"))) { Controls.ShowMessageBox( "Roblox requires the use of Windows Media Foundation components. You appear to be missing them, likely because you are using an N edition of Windows. Please install them first, and then launch Roblox.", @@ -337,7 +337,7 @@ namespace Bloxstrap { // clean up install if (App.IsFirstRun) - Directory.Delete(Directories.Base, true); + Directory.Delete(Paths.Base, true); else if (Directory.Exists(_versionFolder)) Directory.Delete(_versionFolder, true); } @@ -358,25 +358,25 @@ namespace Bloxstrap using (RegistryKey applicationKey = Registry.CurrentUser.CreateSubKey($@"Software\{App.ProjectName}")) { - applicationKey.SetValue("InstallLocation", Directories.Base); + applicationKey.SetValue("InstallLocation", Paths.Base); } // set uninstall key using (RegistryKey uninstallKey = Registry.CurrentUser.CreateSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{App.ProjectName}")) { - uninstallKey.SetValue("DisplayIcon", $"{Directories.Application},0"); + uninstallKey.SetValue("DisplayIcon", $"{Paths.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")); - uninstallKey.SetValue("InstallLocation", Directories.Base); + uninstallKey.SetValue("InstallLocation", Paths.Base); uninstallKey.SetValue("NoRepair", 1); uninstallKey.SetValue("Publisher", "pizzaboxer"); - uninstallKey.SetValue("ModifyPath", $"\"{Directories.Application}\" -menu"); - uninstallKey.SetValue("QuietUninstallString", $"\"{Directories.Application}\" -uninstall -quiet"); - uninstallKey.SetValue("UninstallString", $"\"{Directories.Application}\" -uninstall"); + uninstallKey.SetValue("ModifyPath", $"\"{Paths.Application}\" -menu"); + uninstallKey.SetValue("QuietUninstallString", $"\"{Paths.Application}\" -uninstall -quiet"); + uninstallKey.SetValue("UninstallString", $"\"{Paths.Application}\" -uninstall"); uninstallKey.SetValue("URLInfoAbout", $"https://github.com/{App.ProjectRepository}"); uninstallKey.SetValue("URLUpdateInfo", $"https://github.com/{App.ProjectRepository}/releases/latest"); } @@ -411,19 +411,19 @@ namespace Bloxstrap string? oldInstallLocation = (string?)applicationKey?.GetValue("OldInstallLocation"); - if (applicationKey is null || oldInstallLocation is null || oldInstallLocation == Directories.Base) + if (applicationKey is null || oldInstallLocation is null || oldInstallLocation == Paths.Base) return; SetStatus("Migrating install location..."); if (Directory.Exists(oldInstallLocation)) { - App.Logger.WriteLine(LOG_IDENT, $"Moving all files in {oldInstallLocation} to {Directories.Base}..."); + App.Logger.WriteLine(LOG_IDENT, $"Moving all files in {oldInstallLocation} to {Paths.Base}..."); foreach (string oldFileLocation in Directory.GetFiles(oldInstallLocation, "*.*", SearchOption.AllDirectories)) { string relativeFile = oldFileLocation.Substring(oldInstallLocation.Length + 1); - string newFileLocation = Path.Combine(Directories.Base, relativeFile); + string newFileLocation = Path.Combine(Paths.Base, relativeFile); string? newDirectory = Path.GetDirectoryName(newFileLocation); try @@ -453,8 +453,8 @@ namespace Bloxstrap applicationKey.DeleteValue("OldInstallLocation"); // allow shortcuts to be re-registered - if (Directory.Exists(Directories.StartMenu)) - Directory.Delete(Directories.StartMenu, true); + if (Directory.Exists(Paths.StartMenu)) + Directory.Delete(Paths.StartMenu, true); if (File.Exists(DesktopShortcutLocation)) { @@ -475,41 +475,41 @@ namespace Bloxstrap // this doesn't go under register, so we check every launch // just in case the stock bootstrapper changes it back - ProtocolHandler.Register("roblox", "Roblox", Directories.Application); - ProtocolHandler.Register("roblox-player", "Roblox", Directories.Application); + ProtocolHandler.Register("roblox", "Roblox", Paths.Application); + ProtocolHandler.Register("roblox-player", "Roblox", Paths.Application); // in case the user is reinstalling - if (File.Exists(Directories.Application) && App.IsFirstRun) - File.Delete(Directories.Application); + if (File.Exists(Paths.Application) && App.IsFirstRun) + File.Delete(Paths.Application); // check to make sure bootstrapper is in the install folder - if (!File.Exists(Directories.Application) && Environment.ProcessPath is not null) - File.Copy(Environment.ProcessPath, Directories.Application); + if (!File.Exists(Paths.Application) && Environment.ProcessPath is not null) + File.Copy(Environment.ProcessPath, Paths.Application); // this SHOULD go under Register(), // but then people who have Bloxstrap v1.0.0 installed won't have this without a reinstall // maybe in a later version? - if (!Directory.Exists(Directories.StartMenu)) + if (!Directory.Exists(Paths.StartMenu)) { - Directory.CreateDirectory(Directories.StartMenu); + Directory.CreateDirectory(Paths.StartMenu); - ShellLink.Shortcut.CreateShortcut(Directories.Application, "", Directories.Application, 0) - .WriteToFile(Path.Combine(Directories.StartMenu, "Play Roblox.lnk")); + ShellLink.Shortcut.CreateShortcut(Paths.Application, "", Paths.Application, 0) + .WriteToFile(Path.Combine(Paths.StartMenu, "Play Roblox.lnk")); - ShellLink.Shortcut.CreateShortcut(Directories.Application, "-menu", Directories.Application, 0) - .WriteToFile(Path.Combine(Directories.StartMenu, $"{App.ProjectName} Menu.lnk")); + ShellLink.Shortcut.CreateShortcut(Paths.Application, "-menu", Paths.Application, 0) + .WriteToFile(Path.Combine(Paths.StartMenu, $"{App.ProjectName} Menu.lnk")); } else { // v2.0.0 - rebadge configuration menu as just "Bloxstrap Menu" - string oldMenuShortcut = Path.Combine(Directories.StartMenu, $"Configure {App.ProjectName}.lnk"); - string newMenuShortcut = Path.Combine(Directories.StartMenu, $"{App.ProjectName} Menu.lnk"); + string oldMenuShortcut = Path.Combine(Paths.StartMenu, $"Configure {App.ProjectName}.lnk"); + string newMenuShortcut = Path.Combine(Paths.StartMenu, $"{App.ProjectName} Menu.lnk"); if (File.Exists(oldMenuShortcut)) File.Delete(oldMenuShortcut); if (!File.Exists(newMenuShortcut)) - ShellLink.Shortcut.CreateShortcut(Directories.Application, "-menu", Directories.Application, 0) + ShellLink.Shortcut.CreateShortcut(Paths.Application, "-menu", Paths.Application, 0) .WriteToFile(newMenuShortcut); } @@ -519,7 +519,7 @@ namespace Bloxstrap { try { - ShellLink.Shortcut.CreateShortcut(Directories.Application, "", Directories.Application, 0) + ShellLink.Shortcut.CreateShortcut(Paths.Application, "", Paths.Application, 0) .WriteToFile(DesktopShortcutLocation); } catch (Exception ex) @@ -578,7 +578,7 @@ namespace Bloxstrap // 64-bit is always the first option GithubReleaseAsset asset = releaseInfo.Assets[0]; - string downloadLocation = Path.Combine(Directories.LocalAppData, "Temp", asset.Name); + string downloadLocation = Path.Combine(Paths.LocalAppData, "Temp", asset.Name); App.Logger.WriteLine(LOG_IDENT, $"Downloading {releaseInfo.TagName}..."); @@ -666,29 +666,29 @@ namespace Bloxstrap // if the folder we're installed to does not end with "Bloxstrap", we're installed to a user-selected folder // in which case, chances are they chose to install to somewhere they didn't really mean to (prior to the added warning in 2.4.0) // if so, we're walking on eggshells and have to ensure we only clean up what we need to clean up - bool cautiousUninstall = !Directories.Base.EndsWith(App.ProjectName); + bool cautiousUninstall = !Paths.Base.EndsWith(App.ProjectName); var cleanupSequence = new List { () => Registry.CurrentUser.DeleteSubKey($@"Software\{App.ProjectName}"), - () => Directory.Delete(Directories.StartMenu, true), - () => File.Delete(Path.Combine(Directories.Desktop, "Play Roblox.lnk")), + () => Directory.Delete(Paths.StartMenu, true), + () => File.Delete(Path.Combine(Paths.Desktop, "Play Roblox.lnk")), () => Registry.CurrentUser.DeleteSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{App.ProjectName}") }; if (cautiousUninstall) { - cleanupSequence.Add(() => Directory.Delete(Directories.Downloads, true)); - cleanupSequence.Add(() => Directory.Delete(Directories.Modifications, true)); - cleanupSequence.Add(() => Directory.Delete(Directories.Versions, true)); - cleanupSequence.Add(() => Directory.Delete(Directories.Logs, true)); + cleanupSequence.Add(() => Directory.Delete(Paths.Downloads, true)); + cleanupSequence.Add(() => Directory.Delete(Paths.Modifications, true)); + cleanupSequence.Add(() => Directory.Delete(Paths.Versions, true)); + cleanupSequence.Add(() => Directory.Delete(Paths.Logs, true)); cleanupSequence.Add(() => File.Delete(App.Settings.FileLocation)); cleanupSequence.Add(() => File.Delete(App.State.FileLocation)); } else { - cleanupSequence.Add(() => Directory.Delete(Directories.Base, true)); + cleanupSequence.Add(() => Directory.Delete(Paths.Base, true)); } foreach (var process in cleanupSequence) @@ -706,7 +706,7 @@ namespace Bloxstrap Action? callback = null; - if (Directory.Exists(Directories.Base)) + if (Directory.Exists(Paths.Base)) { callback = delegate { @@ -717,9 +717,9 @@ namespace Bloxstrap string deleteCommand; if (cautiousUninstall) - deleteCommand = $"del /Q \"{Directories.Application}\""; + deleteCommand = $"del /Q \"{Paths.Application}\""; else - deleteCommand = $"del /Q \"{Directories.Base}\\*\" && rmdir \"{Directories.Base}\""; + deleteCommand = $"del /Q \"{Paths.Base}\\*\" && rmdir \"{Paths.Base}\""; Process.Start(new ProcessStartInfo() { @@ -744,16 +744,16 @@ namespace Bloxstrap SetStatus(FreshInstall ? "Installing Roblox..." : "Upgrading Roblox..."); - Directory.CreateDirectory(Directories.Base); - Directory.CreateDirectory(Directories.Downloads); - Directory.CreateDirectory(Directories.Versions); + Directory.CreateDirectory(Paths.Base); + Directory.CreateDirectory(Paths.Downloads); + Directory.CreateDirectory(Paths.Versions); // package manifest states packed size and uncompressed size in exact bytes // packed size only matters if we don't already have the package cached on disk - string[] cachedPackages = Directory.GetFiles(Directories.Downloads); + string[] cachedPackages = Directory.GetFiles(Paths.Downloads); int totalSizeRequired = _versionPackageManifest.Where(x => !cachedPackages.Contains(x.Signature)).Sum(x => x.PackedSize) + _versionPackageManifest.Sum(x => x.Size); - if (Utilities.GetFreeDiskSpace(Directories.Base) < totalSizeRequired) + if (Utilities.GetFreeDiskSpace(Paths.Base) < totalSizeRequired) { Controls.ShowMessageBox( $"{App.ProjectName} does not have enough disk space to download and install Roblox. Please free up some disk space and try again.", @@ -826,7 +826,7 @@ namespace Bloxstrap } } - string oldVersionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid); + string oldVersionFolder = Path.Combine(Paths.Versions, App.State.Prop.VersionGuid); // move old compatibility flags for the old location using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers")) @@ -847,7 +847,7 @@ namespace Bloxstrap // while they were launching a second instance or something idk if (!Process.GetProcessesByName(App.RobloxAppName).Any()) { - foreach (DirectoryInfo dir in new DirectoryInfo(Directories.Versions).GetDirectories()) + foreach (DirectoryInfo dir in new DirectoryInfo(Paths.Versions).GetDirectories()) { if (dir.Name == _latestVersionGuid || !dir.Name.StartsWith("version-")) continue; @@ -918,14 +918,14 @@ namespace Bloxstrap public static void MigrateIntegrations() { // v2.2.0 - remove rbxfpsunlocker - string rbxfpsunlocker = Path.Combine(Directories.Integrations, "rbxfpsunlocker"); + string rbxfpsunlocker = Path.Combine(Paths.Integrations, "rbxfpsunlocker"); if (Directory.Exists(rbxfpsunlocker)) Directory.Delete(rbxfpsunlocker, true); // v2.3.0 - remove reshade - string injectorLocation = Path.Combine(Directories.Modifications, "dxgi.dll"); - string configLocation = Path.Combine(Directories.Modifications, "ReShade.ini"); + string injectorLocation = Path.Combine(Paths.Modifications, "dxgi.dll"); + string configLocation = Path.Combine(Paths.Modifications, "ReShade.ini"); if (File.Exists(injectorLocation)) { @@ -992,10 +992,10 @@ namespace Bloxstrap // handle file mods App.Logger.WriteLine(LOG_IDENT, "Checking file mods..."); - string modFolder = Path.Combine(Directories.Modifications); + string modFolder = Path.Combine(Paths.Modifications); // manifest has been moved to State.json - File.Delete(Path.Combine(Directories.Base, "ModManifest.txt")); + File.Delete(Path.Combine(Paths.Base, "ModManifest.txt")); List modFolderFiles = new(); @@ -1036,7 +1036,7 @@ namespace Bloxstrap await CheckModPreset(App.Settings.Prop.UseOldAvatarBackground && !appDisabled, @"ExtraContent\places\Mobile.rbxl", "OldAvatarBackground.rbxl"); // emoji presets are downloaded remotely from github due to how large they are - string contentFonts = Path.Combine(Directories.Modifications, "content\\fonts"); + string contentFonts = Path.Combine(Paths.Modifications, "content\\fonts"); string emojiFontLocation = Path.Combine(contentFonts, "TwemojiMozilla.ttf"); string emojiFontHash = File.Exists(emojiFontLocation) ? Utility.MD5Hash.FromFile(emojiFontLocation) : ""; @@ -1059,15 +1059,15 @@ namespace Bloxstrap // check custom font mod // instead of replacing the fonts themselves, we'll just alter the font family manifests - string modFontFamiliesFolder = Path.Combine(Directories.Modifications, "content\\fonts\\families"); + string modFontFamiliesFolder = Path.Combine(Paths.Modifications, "content\\fonts\\families"); if (App.IsFirstRun && App.CustomFontLocation is not null) { - Directory.CreateDirectory(Path.GetDirectoryName(Directories.CustomFont)!); - File.Copy(App.CustomFontLocation, Directories.CustomFont); + Directory.CreateDirectory(Path.GetDirectoryName(Paths.CustomFont)!); + File.Copy(App.CustomFontLocation, Paths.CustomFont); } - if (File.Exists(Directories.CustomFont)) + if (File.Exists(Paths.CustomFont)) { App.Logger.WriteLine(LOG_IDENT, "Begin font check"); @@ -1173,7 +1173,7 @@ namespace Bloxstrap private static async Task CheckModPreset(bool condition, string location, string name) { - string fullLocation = Path.Combine(Directories.Modifications, location); + string fullLocation = Path.Combine(Paths.Modifications, location); string fileHash = File.Exists(fullLocation) ? MD5Hash.FromFile(fullLocation) : ""; if (!condition && fileHash == "") @@ -1213,8 +1213,8 @@ namespace Bloxstrap return; string packageUrl = RobloxDeployment.GetLocation($"/{_latestVersionGuid}-{package.Name}"); - string packageLocation = Path.Combine(Directories.Downloads, package.Signature); - string robloxPackageLocation = Path.Combine(Directories.LocalAppData, "Roblox", "Downloads", package.Signature); + string packageLocation = Path.Combine(Paths.Downloads, package.Signature); + string robloxPackageLocation = Path.Combine(Paths.LocalAppData, "Roblox", "Downloads", package.Signature); if (File.Exists(packageLocation)) { @@ -1290,7 +1290,7 @@ namespace Bloxstrap if (_cancelFired) return; - string packageLocation = Path.Combine(Directories.Downloads, package.Signature); + string packageLocation = Path.Combine(Paths.Downloads, package.Signature); string packageFolder = Path.Combine(_versionFolder, PackageDirectories[package.Name]); string extractPath; @@ -1339,7 +1339,7 @@ namespace Bloxstrap DownloadPackage(package).GetAwaiter().GetResult(); - string packageLocation = Path.Combine(Directories.Downloads, package.Signature); + string packageLocation = Path.Combine(Paths.Downloads, package.Signature); string packageFolder = Path.Combine(_versionFolder, PackageDirectories[package.Name]); using ZipArchive archive = ZipFile.OpenRead(packageLocation); diff --git a/Bloxstrap/FastFlagManager.cs b/Bloxstrap/FastFlagManager.cs index 271b4c6..a5caa7d 100644 --- a/Bloxstrap/FastFlagManager.cs +++ b/Bloxstrap/FastFlagManager.cs @@ -5,7 +5,7 @@ namespace Bloxstrap { public class FastFlagManager : JsonManager> { - public override string FileLocation => Path.Combine(Directories.Modifications, "ClientSettings\\ClientAppSettings.json"); + public override string FileLocation => Path.Combine(Paths.Modifications, "ClientSettings\\ClientAppSettings.json"); // this is the value of the 'FStringPartTexturePackTablePre2022' flag public const string OldTexturesFlagValue = "{\"foil\":{\"ids\":[\"rbxassetid://7546645012\",\"rbxassetid://7546645118\"],\"color\":[255,255,255,255]},\"brick\":{\"ids\":[\"rbxassetid://7546650097\",\"rbxassetid://7546645118\"],\"color\":[204,201,200,232]},\"cobblestone\":{\"ids\":[\"rbxassetid://7546652947\",\"rbxassetid://7546645118\"],\"color\":[212,200,187,250]},\"concrete\":{\"ids\":[\"rbxassetid://7546653951\",\"rbxassetid://7546654144\"],\"color\":[208,208,208,255]},\"diamondplate\":{\"ids\":[\"rbxassetid://7547162198\",\"rbxassetid://7546645118\"],\"color\":[170,170,170,255]},\"fabric\":{\"ids\":[\"rbxassetid://7547101130\",\"rbxassetid://7546645118\"],\"color\":[105,104,102,244]},\"glass\":{\"ids\":[\"rbxassetid://7547304948\",\"rbxassetid://7546645118\"],\"color\":[254,254,254,7]},\"granite\":{\"ids\":[\"rbxassetid://7547164710\",\"rbxassetid://7546645118\"],\"color\":[113,113,113,255]},\"grass\":{\"ids\":[\"rbxassetid://7547169285\",\"rbxassetid://7546645118\"],\"color\":[165,165,159,255]},\"ice\":{\"ids\":[\"rbxassetid://7547171356\",\"rbxassetid://7546645118\"],\"color\":[255,255,255,255]},\"marble\":{\"ids\":[\"rbxassetid://7547177270\",\"rbxassetid://7546645118\"],\"color\":[199,199,199,255]},\"metal\":{\"ids\":[\"rbxassetid://7547288171\",\"rbxassetid://7546645118\"],\"color\":[199,199,199,255]},\"pebble\":{\"ids\":[\"rbxassetid://7547291361\",\"rbxassetid://7546645118\"],\"color\":[208,208,208,255]},\"corrodedmetal\":{\"ids\":[\"rbxassetid://7547184629\",\"rbxassetid://7546645118\"],\"color\":[159,119,95,200]},\"sand\":{\"ids\":[\"rbxassetid://7547295153\",\"rbxassetid://7546645118\"],\"color\":[220,220,220,255]},\"slate\":{\"ids\":[\"rbxassetid://7547298114\",\"rbxassetid://7547298323\"],\"color\":[193,193,193,255]},\"wood\":{\"ids\":[\"rbxassetid://7547303225\",\"rbxassetid://7547298786\"],\"color\":[227,227,227,255]},\"woodplanks\":{\"ids\":[\"rbxassetid://7547332968\",\"rbxassetid://7546645118\"],\"color\":[212,209,203,255]},\"asphalt\":{\"ids\":[\"rbxassetid://9873267379\",\"rbxassetid://9438410548\"],\"color\":[123,123,123,234]},\"basalt\":{\"ids\":[\"rbxassetid://9873270487\",\"rbxassetid://9438413638\"],\"color\":[154,154,153,238]},\"crackedlava\":{\"ids\":[\"rbxassetid://9438582231\",\"rbxassetid://9438453972\"],\"color\":[74,78,80,156]},\"glacier\":{\"ids\":[\"rbxassetid://9438851661\",\"rbxassetid://9438453972\"],\"color\":[226,229,229,243]},\"ground\":{\"ids\":[\"rbxassetid://9439044431\",\"rbxassetid://9438453972\"],\"color\":[114,114,112,240]},\"leafygrass\":{\"ids\":[\"rbxassetid://9873288083\",\"rbxassetid://9438453972\"],\"color\":[121,117,113,234]},\"limestone\":{\"ids\":[\"rbxassetid://9873289812\",\"rbxassetid://9438453972\"],\"color\":[235,234,230,250]},\"mud\":{\"ids\":[\"rbxassetid://9873319819\",\"rbxassetid://9438453972\"],\"color\":[130,130,130,252]},\"pavement\":{\"ids\":[\"rbxassetid://9873322398\",\"rbxassetid://9438453972\"],\"color\":[142,142,144,236]},\"rock\":{\"ids\":[\"rbxassetid://9873515198\",\"rbxassetid://9438453972\"],\"color\":[154,154,154,248]},\"salt\":{\"ids\":[\"rbxassetid://9439566986\",\"rbxassetid://9438453972\"],\"color\":[220,220,221,255]},\"sandstone\":{\"ids\":[\"rbxassetid://9873521380\",\"rbxassetid://9438453972\"],\"color\":[174,171,169,246]},\"snow\":{\"ids\":[\"rbxassetid://9439632387\",\"rbxassetid://9438453972\"],\"color\":[218,218,218,255]}}"; diff --git a/Bloxstrap/Integrations/ActivityWatcher.cs b/Bloxstrap/Integrations/ActivityWatcher.cs index 88504d2..4edcff4 100644 --- a/Bloxstrap/Integrations/ActivityWatcher.cs +++ b/Bloxstrap/Integrations/ActivityWatcher.cs @@ -62,7 +62,7 @@ if (App.Settings.Prop.OhHeyYouFoundMe) delay = 250; - string logDirectory = Path.Combine(Directories.LocalAppData, "Roblox\\logs"); + string logDirectory = Path.Combine(Paths.LocalAppData, "Roblox\\logs"); if (!Directory.Exists(logDirectory)) return; diff --git a/Bloxstrap/JsonManager.cs b/Bloxstrap/JsonManager.cs index 791fe88..b002a93 100644 --- a/Bloxstrap/JsonManager.cs +++ b/Bloxstrap/JsonManager.cs @@ -5,7 +5,7 @@ namespace Bloxstrap public class JsonManager where T : new() { public T Prop { get; set; } = new(); - public virtual string FileLocation => Path.Combine(Directories.Base, $"{typeof(T).Name}.json"); + public virtual string FileLocation => Path.Combine(Paths.Base, $"{typeof(T).Name}.json"); private string LOG_IDENT_CLASS => $"JsonManager<{typeof(T).Name}>"; diff --git a/Bloxstrap/Logger.cs b/Bloxstrap/Logger.cs index 62dd45c..7de6a72 100644 --- a/Bloxstrap/Logger.cs +++ b/Bloxstrap/Logger.cs @@ -19,7 +19,7 @@ { const string LOG_IDENT = "Logger::Initialize"; - string directory = useTempDir ? Path.Combine(Directories.LocalAppData, "Temp") : Path.Combine(Directories.Base, "Logs"); + string directory = useTempDir ? Path.Combine(Paths.LocalAppData, "Temp") : Path.Combine(Paths.Base, "Logs"); string timestamp = DateTime.UtcNow.ToString("yyyyMMdd'T'HHmmss'Z'"); string filename = $"{App.ProjectName}_{timestamp}.log"; string location = Path.Combine(directory, filename); @@ -52,9 +52,9 @@ FileLocation = location; // clean up any logs older than a week - if (Directories.Initialized && Directory.Exists(Directories.Logs)) + if (Paths.Initialized && Directory.Exists(Paths.Logs)) { - foreach (FileInfo log in new DirectoryInfo(Directories.Logs).GetFiles()) + foreach (FileInfo log in new DirectoryInfo(Paths.Logs).GetFiles()) { if (log.LastWriteTimeUtc.AddDays(7) > DateTime.UtcNow) continue; @@ -69,7 +69,7 @@ { string timestamp = DateTime.UtcNow.ToString("s") + "Z"; string outcon = $"{timestamp} {message}"; - string outlog = outcon.Replace(Directories.UserProfile, "%UserProfile%"); + string outlog = outcon.Replace(Paths.UserProfile, "%UserProfile%"); Debug.WriteLine(outcon); WriteToLog(outlog); diff --git a/Bloxstrap/Directories.cs b/Bloxstrap/Paths.cs similarity index 98% rename from Bloxstrap/Directories.cs rename to Bloxstrap/Paths.cs index c98a613..db8ea79 100644 --- a/Bloxstrap/Directories.cs +++ b/Bloxstrap/Paths.cs @@ -1,6 +1,6 @@ namespace Bloxstrap { - static class Directories + static class Paths { // note that these are directories that aren't tethered to the basedirectory // so these can safely be called before initialization diff --git a/Bloxstrap/UI/ViewModels/Bootstrapper/ByfronDialogViewModel.cs b/Bloxstrap/UI/ViewModels/Bootstrapper/ByfronDialogViewModel.cs index 29eb85a..5f16722 100644 --- a/Bloxstrap/UI/ViewModels/Bootstrapper/ByfronDialogViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Bootstrapper/ByfronDialogViewModel.cs @@ -20,7 +20,7 @@ namespace Bloxstrap.UI.ViewModels.Bootstrapper { get { - string playerLocation = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid, "RobloxPlayerBeta.exe"); + string playerLocation = Path.Combine(Paths.Versions, App.State.Prop.VersionGuid, "RobloxPlayerBeta.exe"); if (!File.Exists(playerLocation)) return ""; diff --git a/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs index c00093c..8dbe56c 100644 --- a/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs @@ -31,7 +31,7 @@ namespace Bloxstrap.UI.ViewModels.Menu private void OpenFolder() { - Process.Start("explorer.exe", Directories.Base); + Process.Start("explorer.exe", Paths.Base); } public string InstallLocation diff --git a/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs index 3b11164..bc868bd 100644 --- a/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs @@ -132,7 +132,7 @@ namespace Bloxstrap.UI.ViewModels.Menu using RegistryKey registryKey = Registry.CurrentUser.CreateSubKey($@"Software\{App.ProjectName}"); registryKey.SetValue("InstallLocation", App.BaseDirectory); registryKey.SetValue("OldInstallLocation", _originalBaseDirectory); - Directories.Initialize(App.BaseDirectory); + Paths.Initialize(App.BaseDirectory); } CloseWindow(); diff --git a/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs index a5fde9c..261e09c 100644 --- a/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs @@ -9,9 +9,9 @@ namespace Bloxstrap.UI.ViewModels.Menu { public class ModsViewModel : NotifyPropertyChangedViewModel { - private void OpenModsFolder() => Process.Start("explorer.exe", Directories.Modifications); + private void OpenModsFolder() => Process.Start("explorer.exe", Paths.Modifications); - private bool _usingCustomFont => App.IsFirstRun && App.CustomFontLocation is not null || !App.IsFirstRun && File.Exists(Directories.CustomFont); + private bool _usingCustomFont => App.IsFirstRun && App.CustomFontLocation is not null || !App.IsFirstRun && File.Exists(Paths.CustomFont); private void ManageCustomFont() { @@ -20,7 +20,7 @@ namespace Bloxstrap.UI.ViewModels.Menu if (App.IsFirstRun) App.CustomFontLocation = null; else - File.Delete(Directories.CustomFont); + File.Delete(Paths.CustomFont); } else { @@ -38,8 +38,8 @@ namespace Bloxstrap.UI.ViewModels.Menu } else { - Directory.CreateDirectory(Path.GetDirectoryName(Directories.CustomFont)!); - File.Copy(dialog.FileName, Directories.CustomFont); + Directory.CreateDirectory(Path.GetDirectoryName(Paths.CustomFont)!); + File.Copy(dialog.FileName, Paths.CustomFont); } } diff --git a/Bloxstrap/Updater.cs b/Bloxstrap/Updater.cs index 601d508..41ac472 100644 --- a/Bloxstrap/Updater.cs +++ b/Bloxstrap/Updater.cs @@ -8,15 +8,15 @@ namespace Bloxstrap { const string LOG_IDENT = "Updater::CheckInstalledVersion"; - if (Environment.ProcessPath is null || !File.Exists(Directories.Application) || Environment.ProcessPath == Directories.Application) + if (Environment.ProcessPath is null || !File.Exists(Paths.Application) || Environment.ProcessPath == Paths.Application) return; // 2.0.0 downloads updates to /Updates so lol - bool isAutoUpgrade = Environment.ProcessPath.StartsWith(Path.Combine(Directories.Base, "Updates")) || Environment.ProcessPath.StartsWith(Path.Combine(Directories.LocalAppData, "Temp")); + bool isAutoUpgrade = Environment.ProcessPath.StartsWith(Path.Combine(Paths.Base, "Updates")) || Environment.ProcessPath.StartsWith(Path.Combine(Paths.LocalAppData, "Temp")); FileVersionInfo currentVersionInfo = FileVersionInfo.GetVersionInfo(Environment.ProcessPath); - if (MD5Hash.FromFile(Environment.ProcessPath) == MD5Hash.FromFile(Directories.Application)) + if (MD5Hash.FromFile(Environment.ProcessPath) == MD5Hash.FromFile(Paths.Application)) return; MessageBoxResult result; @@ -47,7 +47,7 @@ namespace Bloxstrap try { - File.Delete(Directories.Application); + File.Delete(Paths.Application); break; } catch (Exception) @@ -65,7 +65,7 @@ namespace Bloxstrap return; } - File.Copy(Environment.ProcessPath, Directories.Application); + File.Copy(Environment.ProcessPath, Paths.Application); Bootstrapper.Register();