diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 2a71a71..007cd18 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -223,10 +223,10 @@ namespace Bloxstrap { SetStatus("Connecting to Roblox..."); - ClientVersion clientVersion = await Deployment.GetInfo(App.Settings.Prop.Channel); + ClientVersion clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); // briefly check if current channel is suitable to use - if (App.Settings.Prop.Channel.ToLower() != Deployment.DefaultChannel.ToLower() && App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Ignore) + if (App.Settings.Prop.Channel.ToLower() != RobloxDeployment.DefaultChannel.ToLower() && App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Ignore) { string? switchDefaultPrompt = null; ClientVersion? defaultChannelInfo = null; @@ -235,21 +235,21 @@ namespace Bloxstrap if (App.Settings.Prop.UseReShade) { - string manifest = await App.HttpClient.GetStringAsync(Deployment.GetLocation($"/{clientVersion.VersionGuid}-rbxManifest.txt")); + string manifest = await App.HttpClient.GetStringAsync(RobloxDeployment.GetLocation($"/{clientVersion.VersionGuid}-rbxManifest.txt")); if (manifest.Contains("RobloxPlayerBeta.dll")) - switchDefaultPrompt = $"You currently have ReShade enabled, however your current preferred channel ({App.Settings.Prop.Channel}) does not support ReShade. Would you like to switch to {Deployment.DefaultChannel}?"; + switchDefaultPrompt = $"You currently have ReShade enabled, however your current preferred channel ({App.Settings.Prop.Channel}) does not support ReShade. Would you like to switch to {RobloxDeployment.DefaultChannel}?"; } if (String.IsNullOrEmpty(switchDefaultPrompt)) { // this SUCKS - defaultChannelInfo = await Deployment.GetInfo(Deployment.DefaultChannel); + defaultChannelInfo = await RobloxDeployment.GetInfo(RobloxDeployment.DefaultChannel); int defaultChannelVersion = Int32.Parse(defaultChannelInfo.Version.Split('.')[1]); int currentChannelVersion = Int32.Parse(clientVersion.Version.Split('.')[1]); if (currentChannelVersion < defaultChannelVersion) - switchDefaultPrompt = $"Your current preferred channel ({App.Settings.Prop.Channel}) appears to no longer be receiving updates. Would you like to switch to {Deployment.DefaultChannel}?"; + switchDefaultPrompt = $"Your current preferred channel ({App.Settings.Prop.Channel}) appears to no longer be receiving updates. Would you like to switch to {RobloxDeployment.DefaultChannel}?"; } if (!String.IsNullOrEmpty(switchDefaultPrompt)) @@ -258,11 +258,11 @@ namespace Bloxstrap if (result == MessageBoxResult.Yes) { - App.Settings.Prop.Channel = Deployment.DefaultChannel; - App.Logger.WriteLine($"[DeployManager::SwitchToDefault] Changed Roblox release channel from {App.Settings.Prop.Channel} to {Deployment.DefaultChannel}"); + App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel; + App.Logger.WriteLine($"[DeployManager::SwitchToDefault] Changed Roblox release channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}"); if (defaultChannelInfo is null) - defaultChannelInfo = await Deployment.GetInfo(Deployment.DefaultChannel); + defaultChannelInfo = await RobloxDeployment.GetInfo(RobloxDeployment.DefaultChannel); clientVersion = defaultChannelInfo; } @@ -287,7 +287,7 @@ namespace Bloxstrap _launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString()); - if (App.Settings.Prop.Channel.ToLower() != Deployment.DefaultChannel.ToLower()) + if (App.Settings.Prop.Channel.ToLower() != RobloxDeployment.DefaultChannel.ToLower()) _launchCommandLine += " -channel " + App.Settings.Prop.Channel.ToLower(); // whether we should wait for roblox to exit to handle stuff in the background or clean up after roblox closes @@ -301,7 +301,7 @@ namespace Bloxstrap } List autocloseProcesses = new(); - GameActivityWatcher? activityWatcher = null; + RobloxActivity? activityWatcher = null; DiscordRichPresence? richPresence = null; ServerNotifier? serverNotifier = null; @@ -1007,7 +1007,7 @@ namespace Bloxstrap if (_cancelFired) return; - string packageUrl = Deployment.GetLocation($"/{_latestVersionGuid}-{package.Name}"); + 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); diff --git a/Bloxstrap/Integrations/DiscordRichPresence.cs b/Bloxstrap/Integrations/DiscordRichPresence.cs index e4b8abf..69c10e4 100644 --- a/Bloxstrap/Integrations/DiscordRichPresence.cs +++ b/Bloxstrap/Integrations/DiscordRichPresence.cs @@ -12,12 +12,12 @@ namespace Bloxstrap.Integrations public class DiscordRichPresence : IDisposable { private readonly DiscordRpcClient _rpcClient = new("1005469189907173486"); - private readonly GameActivityWatcher _activityWatcher; + private readonly RobloxActivity _activityWatcher; private long _currentUniverseId; private DateTime? _timeStartedUniverse; - public DiscordRichPresence(GameActivityWatcher activityWatcher) + public DiscordRichPresence(RobloxActivity activityWatcher) { _activityWatcher = activityWatcher; diff --git a/Bloxstrap/Integrations/ServerNotifier.cs b/Bloxstrap/Integrations/ServerNotifier.cs index bdd1678..bfd55be 100644 --- a/Bloxstrap/Integrations/ServerNotifier.cs +++ b/Bloxstrap/Integrations/ServerNotifier.cs @@ -6,9 +6,9 @@ namespace Bloxstrap.Integrations { public class ServerNotifier { - private readonly GameActivityWatcher _activityWatcher; + private readonly RobloxActivity _activityWatcher; - public ServerNotifier(GameActivityWatcher activityWatcher) + public ServerNotifier(RobloxActivity activityWatcher) { _activityWatcher = activityWatcher; _activityWatcher.OnGameJoin += (_, _) => Task.Run(() => Notify()); diff --git a/Bloxstrap/Models/PackageManifest.cs b/Bloxstrap/Models/PackageManifest.cs index 4f1dde9..72eb799 100644 --- a/Bloxstrap/Models/PackageManifest.cs +++ b/Bloxstrap/Models/PackageManifest.cs @@ -54,7 +54,7 @@ namespace Bloxstrap.Models public static async Task Get(string versionGuid) { - string pkgManifestUrl = Deployment.GetLocation($"/{versionGuid}-rbxPkgManifest.txt"); + string pkgManifestUrl = RobloxDeployment.GetLocation($"/{versionGuid}-rbxPkgManifest.txt"); var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl); return new PackageManifest(pkgManifestData); diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs index e231bb0..c6b1327 100644 --- a/Bloxstrap/Models/Settings.cs +++ b/Bloxstrap/Models/Settings.cs @@ -17,7 +17,7 @@ namespace Bloxstrap.Models public bool MultiInstanceLaunching { get; set; } = false; // channel configuration - public string Channel { get; set; } = Deployment.DefaultChannel; + public string Channel { get; set; } = RobloxDeployment.DefaultChannel; public ChannelChangeMode ChannelChangeMode { get; set; } = ChannelChangeMode.Automatic; // integration configuration diff --git a/Bloxstrap/GameActivityWatcher.cs b/Bloxstrap/RobloxActivity.cs similarity index 79% rename from Bloxstrap/GameActivityWatcher.cs rename to Bloxstrap/RobloxActivity.cs index 523f6db..5076f79 100644 --- a/Bloxstrap/GameActivityWatcher.cs +++ b/Bloxstrap/RobloxActivity.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Bloxstrap { - public class GameActivityWatcher : IDisposable + public class RobloxActivity : IDisposable { // i'm thinking the functionality for parsing roblox logs could be broadened for more features than just rich presence, // like checking the ping and region of the current connected server. maybe that's something to add? @@ -62,7 +62,7 @@ namespace Bloxstrap // if roblox doesn't start quickly enough, we can wind up fetching the previous log file // good rule of thumb is to find a log file that was created in the last 15 seconds or so - App.Logger.WriteLine("[GameActivityWatcher::StartWatcher] Opening Roblox log file..."); + App.Logger.WriteLine("[RobloxActivity::StartWatcher] Opening Roblox log file..."); while (true) { @@ -71,12 +71,12 @@ namespace Bloxstrap if (logFileInfo.CreationTime.AddSeconds(15) > DateTime.Now) break; - App.Logger.WriteLine($"[GameActivityWatcher::StartWatcher] Could not find recent enough log file, waiting... (newest is {logFileInfo.Name})"); + App.Logger.WriteLine($"[RobloxActivity::StartWatcher] Could not find recent enough log file, waiting... (newest is {logFileInfo.Name})"); await Task.Delay(1000); } FileStream logFileStream = logFileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - App.Logger.WriteLine($"[GameActivityWatcher::StartWatcher] Opened {logFileInfo.Name}"); + App.Logger.WriteLine($"[RobloxActivity::StartWatcher] Opened {logFileInfo.Name}"); AutoResetEvent logUpdatedEvent = new(false); FileSystemWatcher logWatcher = new() @@ -108,9 +108,9 @@ namespace Bloxstrap // debug stats to ensure that the log reader is working correctly // if more than 1000 log entries have been read, only log per 100 to save on spam if (_logEntriesRead <= 1000 && _logEntriesRead % 50 == 0) - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Read {_logEntriesRead} log entries"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Read {_logEntriesRead} log entries"); else if (_logEntriesRead % 100 == 0) - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Read {_logEntriesRead} log entries"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Read {_logEntriesRead} log entries"); if (!ActivityInGame && ActivityPlaceId == 0 && entry.Contains(GameJoiningEntry)) { @@ -118,7 +118,7 @@ namespace Bloxstrap if (match.Groups.Count != 4) { - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Failed to assert format for game join entry"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Failed to assert format for game join entry"); App.Logger.WriteLine(entry); return; } @@ -128,7 +128,7 @@ namespace Bloxstrap ActivityJobId = match.Groups[1].Value; ActivityMachineAddress = match.Groups[3].Value; - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Joining Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Joining Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); } else if (!ActivityInGame && ActivityPlaceId != 0) { @@ -138,7 +138,7 @@ namespace Bloxstrap if (match.Groups.Count != 3 || match.Groups[2].Value != ActivityMachineAddress) { - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Failed to assert format for game join UDMUX entry"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Failed to assert format for game join UDMUX entry"); App.Logger.WriteLine(entry); return; } @@ -146,7 +146,7 @@ namespace Bloxstrap ActivityMachineAddress = match.Groups[1].Value; ActivityMachineUDMUX = true; - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Server is UDMUX protected ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Server is UDMUX protected ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); } else if (entry.Contains(GameJoinedEntry)) { @@ -154,12 +154,12 @@ namespace Bloxstrap if (match.Groups.Count != 2 || match.Groups[1].Value != ActivityMachineAddress) { - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Failed to assert format for game joined entry"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Failed to assert format for game joined entry"); App.Logger.WriteLine(entry); return; } - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Joined Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Joined Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); ActivityInGame = true; OnGameJoin?.Invoke(this, new EventArgs()); @@ -169,7 +169,7 @@ namespace Bloxstrap { if (entry.Contains(GameDisconnectedEntry)) { - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Disconnected from Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Disconnected from Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); ActivityInGame = false; ActivityPlaceId = 0; @@ -181,7 +181,7 @@ namespace Bloxstrap } else if (entry.Contains(GameTeleportingEntry)) { - App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Initiating teleport to server ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); + App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Initiating teleport to server ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); ActivityIsTeleport = true; } } diff --git a/Bloxstrap/Deployment.cs b/Bloxstrap/RobloxDeployment.cs similarity index 89% rename from Bloxstrap/Deployment.cs rename to Bloxstrap/RobloxDeployment.cs index c46d618..993618a 100644 --- a/Bloxstrap/Deployment.cs +++ b/Bloxstrap/RobloxDeployment.cs @@ -9,7 +9,7 @@ using Bloxstrap.Models; namespace Bloxstrap { - public static class Deployment + public static class RobloxDeployment { #region Properties public const string DefaultChannel = "LIVE"; @@ -89,7 +89,7 @@ namespace Bloxstrap public static async Task GetInfo(string channel, bool timestamp = false) { - App.Logger.WriteLine($"[DeployManager::GetInfo] Getting deploy info for channel {channel} (timestamp={timestamp})"); + App.Logger.WriteLine($"[RobloxDeployment::GetInfo] Getting deploy info for channel {channel} (timestamp={timestamp})"); HttpResponseMessage deployInfoResponse = await App.HttpClient.GetAsync($"https://clientsettingscdn.roblox.com/v2/client-version/WindowsPlayer/channel/{channel}"); @@ -103,7 +103,7 @@ namespace Bloxstrap // either way, we throw App.Logger.WriteLine( - "[DeployManager::GetInfo] Failed to fetch deploy info!\r\n" + + "[RobloxDeployment::GetInfo] Failed to fetch deploy info!\r\n" + $"\tStatus code: {deployInfoResponse.StatusCode}\r\n" + $"\tResponse: {rawResponse}" ); @@ -111,14 +111,14 @@ namespace Bloxstrap throw new Exception($"Could not get latest deploy for channel {channel}! (HTTP {deployInfoResponse.StatusCode})"); } - App.Logger.WriteLine($"[DeployManager::GetInfo] Got JSON: {rawResponse}"); + App.Logger.WriteLine($"[RobloxDeployment::GetInfo] Got JSON: {rawResponse}"); ClientVersion clientVersion = JsonSerializer.Deserialize(rawResponse)!; // for preferences if (timestamp) { - App.Logger.WriteLine("[DeployManager::GetInfo] Getting timestamp..."); + App.Logger.WriteLine("[RobloxDeployment::GetInfo] Getting timestamp..."); string manifestUrl = GetLocation($"/{clientVersion.VersionGuid}-rbxPkgManifest.txt", channel); @@ -128,7 +128,7 @@ namespace Bloxstrap if (pkgResponse.Content.Headers.TryGetValues("last-modified", out var values)) { string lastModified = values.First(); - App.Logger.WriteLine($"[DeployManager::GetInfo] {manifestUrl} - Last-Modified: {lastModified}"); + App.Logger.WriteLine($"[RobloxDeployment::GetInfo] {manifestUrl} - Last-Modified: {lastModified}"); clientVersion.Timestamp = DateTime.Parse(lastModified).ToLocalTime(); } } diff --git a/Bloxstrap/ViewModels/InstallationViewModel.cs b/Bloxstrap/ViewModels/InstallationViewModel.cs index 390d9de..7eca88e 100644 --- a/Bloxstrap/ViewModels/InstallationViewModel.cs +++ b/Bloxstrap/ViewModels/InstallationViewModel.cs @@ -19,7 +19,7 @@ namespace Bloxstrap.ViewModels public event PropertyChangedEventHandler? PropertyChanged; public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - private bool _manualChannelEntry = !Deployment.SelectableChannels.Contains(App.Settings.Prop.Channel); + private bool _manualChannelEntry = !RobloxDeployment.SelectableChannels.Contains(App.Settings.Prop.Channel); public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation); public ICommand OpenFolderCommand => new RelayCommand(OpenFolder); @@ -42,7 +42,7 @@ namespace Bloxstrap.ViewModels try { - ClientVersion info = await Deployment.GetInfo(channel, true); + ClientVersion info = await RobloxDeployment.GetInfo(channel, true); ChannelDeployInfo = new DeployInfo { @@ -82,7 +82,7 @@ namespace Bloxstrap.ViewModels set => App.BaseDirectory = value; } - public IEnumerable Channels => Deployment.SelectableChannels; + public IEnumerable Channels => RobloxDeployment.SelectableChannels; public string Channel { @@ -105,7 +105,7 @@ namespace Bloxstrap.ViewModels { // roblox typically sets channels in all lowercase, so here we find if a case insensitive match exists string? matchingChannel = Channels.Where(x => x.ToLower() == Channel.ToLower()).FirstOrDefault(); - Channel = String.IsNullOrEmpty(matchingChannel) ? Deployment.DefaultChannel : matchingChannel; + Channel = String.IsNullOrEmpty(matchingChannel) ? RobloxDeployment.DefaultChannel : matchingChannel; } OnPropertyChanged(nameof(Channel));