Rename a bunch of classes

yea
This commit is contained in:
pizzaboxer 2023-05-03 18:19:26 +01:00
parent e4ae6f6ccc
commit d1527535e4
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
8 changed files with 42 additions and 42 deletions

View File

@ -223,10 +223,10 @@ namespace Bloxstrap
{ {
SetStatus("Connecting to Roblox..."); 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 // 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; string? switchDefaultPrompt = null;
ClientVersion? defaultChannelInfo = null; ClientVersion? defaultChannelInfo = null;
@ -235,21 +235,21 @@ namespace Bloxstrap
if (App.Settings.Prop.UseReShade) 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")) 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)) if (String.IsNullOrEmpty(switchDefaultPrompt))
{ {
// this SUCKS // this SUCKS
defaultChannelInfo = await Deployment.GetInfo(Deployment.DefaultChannel); defaultChannelInfo = await RobloxDeployment.GetInfo(RobloxDeployment.DefaultChannel);
int defaultChannelVersion = Int32.Parse(defaultChannelInfo.Version.Split('.')[1]); int defaultChannelVersion = Int32.Parse(defaultChannelInfo.Version.Split('.')[1]);
int currentChannelVersion = Int32.Parse(clientVersion.Version.Split('.')[1]); int currentChannelVersion = Int32.Parse(clientVersion.Version.Split('.')[1]);
if (currentChannelVersion < defaultChannelVersion) 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)) if (!String.IsNullOrEmpty(switchDefaultPrompt))
@ -258,11 +258,11 @@ namespace Bloxstrap
if (result == MessageBoxResult.Yes) if (result == MessageBoxResult.Yes)
{ {
App.Settings.Prop.Channel = Deployment.DefaultChannel; App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel;
App.Logger.WriteLine($"[DeployManager::SwitchToDefault] Changed Roblox release channel from {App.Settings.Prop.Channel} to {Deployment.DefaultChannel}"); App.Logger.WriteLine($"[DeployManager::SwitchToDefault] Changed Roblox release channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}");
if (defaultChannelInfo is null) if (defaultChannelInfo is null)
defaultChannelInfo = await Deployment.GetInfo(Deployment.DefaultChannel); defaultChannelInfo = await RobloxDeployment.GetInfo(RobloxDeployment.DefaultChannel);
clientVersion = defaultChannelInfo; clientVersion = defaultChannelInfo;
} }
@ -287,7 +287,7 @@ namespace Bloxstrap
_launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString()); _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(); _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 // 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<Process> autocloseProcesses = new(); List<Process> autocloseProcesses = new();
GameActivityWatcher? activityWatcher = null; RobloxActivity? activityWatcher = null;
DiscordRichPresence? richPresence = null; DiscordRichPresence? richPresence = null;
ServerNotifier? serverNotifier = null; ServerNotifier? serverNotifier = null;
@ -1007,7 +1007,7 @@ namespace Bloxstrap
if (_cancelFired) if (_cancelFired)
return; return;
string packageUrl = Deployment.GetLocation($"/{_latestVersionGuid}-{package.Name}"); string packageUrl = RobloxDeployment.GetLocation($"/{_latestVersionGuid}-{package.Name}");
string packageLocation = Path.Combine(Directories.Downloads, package.Signature); string packageLocation = Path.Combine(Directories.Downloads, package.Signature);
string robloxPackageLocation = Path.Combine(Directories.LocalAppData, "Roblox", "Downloads", package.Signature); string robloxPackageLocation = Path.Combine(Directories.LocalAppData, "Roblox", "Downloads", package.Signature);

View File

@ -12,12 +12,12 @@ namespace Bloxstrap.Integrations
public class DiscordRichPresence : IDisposable public class DiscordRichPresence : IDisposable
{ {
private readonly DiscordRpcClient _rpcClient = new("1005469189907173486"); private readonly DiscordRpcClient _rpcClient = new("1005469189907173486");
private readonly GameActivityWatcher _activityWatcher; private readonly RobloxActivity _activityWatcher;
private long _currentUniverseId; private long _currentUniverseId;
private DateTime? _timeStartedUniverse; private DateTime? _timeStartedUniverse;
public DiscordRichPresence(GameActivityWatcher activityWatcher) public DiscordRichPresence(RobloxActivity activityWatcher)
{ {
_activityWatcher = activityWatcher; _activityWatcher = activityWatcher;

View File

@ -6,9 +6,9 @@ namespace Bloxstrap.Integrations
{ {
public class ServerNotifier public class ServerNotifier
{ {
private readonly GameActivityWatcher _activityWatcher; private readonly RobloxActivity _activityWatcher;
public ServerNotifier(GameActivityWatcher activityWatcher) public ServerNotifier(RobloxActivity activityWatcher)
{ {
_activityWatcher = activityWatcher; _activityWatcher = activityWatcher;
_activityWatcher.OnGameJoin += (_, _) => Task.Run(() => Notify()); _activityWatcher.OnGameJoin += (_, _) => Task.Run(() => Notify());

View File

@ -54,7 +54,7 @@ namespace Bloxstrap.Models
public static async Task<PackageManifest> Get(string versionGuid) public static async Task<PackageManifest> Get(string versionGuid)
{ {
string pkgManifestUrl = Deployment.GetLocation($"/{versionGuid}-rbxPkgManifest.txt"); string pkgManifestUrl = RobloxDeployment.GetLocation($"/{versionGuid}-rbxPkgManifest.txt");
var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl); var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl);
return new PackageManifest(pkgManifestData); return new PackageManifest(pkgManifestData);

View File

@ -17,7 +17,7 @@ namespace Bloxstrap.Models
public bool MultiInstanceLaunching { get; set; } = false; public bool MultiInstanceLaunching { get; set; } = false;
// channel configuration // channel configuration
public string Channel { get; set; } = Deployment.DefaultChannel; public string Channel { get; set; } = RobloxDeployment.DefaultChannel;
public ChannelChangeMode ChannelChangeMode { get; set; } = ChannelChangeMode.Automatic; public ChannelChangeMode ChannelChangeMode { get; set; } = ChannelChangeMode.Automatic;
// integration configuration // integration configuration

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Bloxstrap 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, // 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? // 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 // 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 // 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) while (true)
{ {
@ -71,12 +71,12 @@ namespace Bloxstrap
if (logFileInfo.CreationTime.AddSeconds(15) > DateTime.Now) if (logFileInfo.CreationTime.AddSeconds(15) > DateTime.Now)
break; 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); await Task.Delay(1000);
} }
FileStream logFileStream = logFileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 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); AutoResetEvent logUpdatedEvent = new(false);
FileSystemWatcher logWatcher = new() FileSystemWatcher logWatcher = new()
@ -108,9 +108,9 @@ namespace Bloxstrap
// debug stats to ensure that the log reader is working correctly // 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 more than 1000 log entries have been read, only log per 100 to save on spam
if (_logEntriesRead <= 1000 && _logEntriesRead % 50 == 0) 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) 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)) if (!ActivityInGame && ActivityPlaceId == 0 && entry.Contains(GameJoiningEntry))
{ {
@ -118,7 +118,7 @@ namespace Bloxstrap
if (match.Groups.Count != 4) 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); App.Logger.WriteLine(entry);
return; return;
} }
@ -128,7 +128,7 @@ namespace Bloxstrap
ActivityJobId = match.Groups[1].Value; ActivityJobId = match.Groups[1].Value;
ActivityMachineAddress = match.Groups[3].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) else if (!ActivityInGame && ActivityPlaceId != 0)
{ {
@ -138,7 +138,7 @@ namespace Bloxstrap
if (match.Groups.Count != 3 || match.Groups[2].Value != ActivityMachineAddress) 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); App.Logger.WriteLine(entry);
return; return;
} }
@ -146,7 +146,7 @@ namespace Bloxstrap
ActivityMachineAddress = match.Groups[1].Value; ActivityMachineAddress = match.Groups[1].Value;
ActivityMachineUDMUX = true; 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)) else if (entry.Contains(GameJoinedEntry))
{ {
@ -154,12 +154,12 @@ namespace Bloxstrap
if (match.Groups.Count != 2 || match.Groups[1].Value != ActivityMachineAddress) 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); App.Logger.WriteLine(entry);
return; return;
} }
App.Logger.WriteLine($"[GameActivityWatcher::ExamineLogEntry] Joined Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})"); App.Logger.WriteLine($"[RobloxActivity::ExamineLogEntry] Joined Game ({ActivityPlaceId}/{ActivityJobId}/{ActivityMachineAddress})");
ActivityInGame = true; ActivityInGame = true;
OnGameJoin?.Invoke(this, new EventArgs()); OnGameJoin?.Invoke(this, new EventArgs());
@ -169,7 +169,7 @@ namespace Bloxstrap
{ {
if (entry.Contains(GameDisconnectedEntry)) 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; ActivityInGame = false;
ActivityPlaceId = 0; ActivityPlaceId = 0;
@ -181,7 +181,7 @@ namespace Bloxstrap
} }
else if (entry.Contains(GameTeleportingEntry)) 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; ActivityIsTeleport = true;
} }
} }

View File

@ -9,7 +9,7 @@ using Bloxstrap.Models;
namespace Bloxstrap namespace Bloxstrap
{ {
public static class Deployment public static class RobloxDeployment
{ {
#region Properties #region Properties
public const string DefaultChannel = "LIVE"; public const string DefaultChannel = "LIVE";
@ -89,7 +89,7 @@ namespace Bloxstrap
public static async Task<ClientVersion> GetInfo(string channel, bool timestamp = false) public static async Task<ClientVersion> 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}"); 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 // either way, we throw
App.Logger.WriteLine( 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" + $"\tStatus code: {deployInfoResponse.StatusCode}\r\n" +
$"\tResponse: {rawResponse}" $"\tResponse: {rawResponse}"
); );
@ -111,14 +111,14 @@ namespace Bloxstrap
throw new Exception($"Could not get latest deploy for channel {channel}! (HTTP {deployInfoResponse.StatusCode})"); 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<ClientVersion>(rawResponse)!; ClientVersion clientVersion = JsonSerializer.Deserialize<ClientVersion>(rawResponse)!;
// for preferences // for preferences
if (timestamp) if (timestamp)
{ {
App.Logger.WriteLine("[DeployManager::GetInfo] Getting timestamp..."); App.Logger.WriteLine("[RobloxDeployment::GetInfo] Getting timestamp...");
string manifestUrl = GetLocation($"/{clientVersion.VersionGuid}-rbxPkgManifest.txt", channel); string manifestUrl = GetLocation($"/{clientVersion.VersionGuid}-rbxPkgManifest.txt", channel);
@ -128,7 +128,7 @@ namespace Bloxstrap
if (pkgResponse.Content.Headers.TryGetValues("last-modified", out var values)) if (pkgResponse.Content.Headers.TryGetValues("last-modified", out var values))
{ {
string lastModified = values.First(); string lastModified = values.First();
App.Logger.WriteLine($"[DeployManager::GetInfo] {manifestUrl} - Last-Modified: {lastModified}"); App.Logger.WriteLine($"[RobloxDeployment::GetInfo] {manifestUrl} - Last-Modified: {lastModified}");
clientVersion.Timestamp = DateTime.Parse(lastModified).ToLocalTime(); clientVersion.Timestamp = DateTime.Parse(lastModified).ToLocalTime();
} }
} }

View File

@ -19,7 +19,7 @@ namespace Bloxstrap.ViewModels
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 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 BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);
public ICommand OpenFolderCommand => new RelayCommand(OpenFolder); public ICommand OpenFolderCommand => new RelayCommand(OpenFolder);
@ -42,7 +42,7 @@ namespace Bloxstrap.ViewModels
try try
{ {
ClientVersion info = await Deployment.GetInfo(channel, true); ClientVersion info = await RobloxDeployment.GetInfo(channel, true);
ChannelDeployInfo = new DeployInfo ChannelDeployInfo = new DeployInfo
{ {
@ -82,7 +82,7 @@ namespace Bloxstrap.ViewModels
set => App.BaseDirectory = value; set => App.BaseDirectory = value;
} }
public IEnumerable<string> Channels => Deployment.SelectableChannels; public IEnumerable<string> Channels => RobloxDeployment.SelectableChannels;
public string Channel 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 // 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(); 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)); OnPropertyChanged(nameof(Channel));