add version and channel arguments

This commit is contained in:
bluepilledgreat 2025-03-11 22:32:21 +00:00
parent 9a90d8935a
commit 7a539acfcf
2 changed files with 40 additions and 15 deletions

View File

@ -293,7 +293,12 @@ namespace Bloxstrap
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant RegexOptions.IgnoreCase | RegexOptions.CultureInvariant
); );
if (match.Groups.Count == 2) if (App.LaunchSettings.ChannelFlag.Active && !string.IsNullOrEmpty(App.LaunchSettings.ChannelFlag.Data))
{
App.Logger.WriteLine(LOG_IDENT, $"Channel set to {App.LaunchSettings.ChannelFlag.Data} from arguments");
Deployment.Channel = App.LaunchSettings.ChannelFlag.Data.ToLowerInvariant();
}
else if (match.Groups.Count == 2)
{ {
Deployment.Channel = match.Groups[1].Value.ToLowerInvariant(); Deployment.Channel = match.Groups[1].Value.ToLowerInvariant();
} }
@ -310,23 +315,32 @@ namespace Bloxstrap
if (!Deployment.IsDefaultChannel) if (!Deployment.IsDefaultChannel)
App.SendStat("robloxChannel", Deployment.Channel); App.SendStat("robloxChannel", Deployment.Channel);
ClientVersion clientVersion; if (!App.LaunchSettings.VersionFlag.Active || string.IsNullOrEmpty(App.LaunchSettings.VersionFlag.Data))
try
{ {
clientVersion = await Deployment.GetInfo(); ClientVersion clientVersion;
try
{
clientVersion = await Deployment.GetInfo();
}
catch (InvalidChannelException ex)
{
App.Logger.WriteLine(LOG_IDENT, $"Resetting channel from {Deployment.Channel} because {ex.StatusCode}");
Deployment.Channel = Deployment.DefaultChannel;
clientVersion = await Deployment.GetInfo();
}
key.SetValueSafe("www.roblox.com", Deployment.IsDefaultChannel ? "" : Deployment.Channel);
_latestVersionGuid = clientVersion.VersionGuid;
} }
catch (InvalidChannelException ex) else
{ {
App.Logger.WriteLine(LOG_IDENT, $"Resetting channel from {Deployment.Channel} because {ex.StatusCode}"); App.Logger.WriteLine(LOG_IDENT, $"Version set to {App.LaunchSettings.VersionFlag.Data} from arguments");
_latestVersionGuid = App.LaunchSettings.VersionFlag.Data;
Deployment.Channel = Deployment.DefaultChannel;
clientVersion = await Deployment.GetInfo();
} }
key.SetValueSafe("www.roblox.com", Deployment.IsDefaultChannel ? "" : Deployment.Channel);
_latestVersionGuid = clientVersion.VersionGuid;
_latestVersionDirectory = Path.Combine(Paths.Versions, _latestVersionGuid); _latestVersionDirectory = Path.Combine(Paths.Versions, _latestVersionGuid);
string pkgManifestUrl = Deployment.GetLocation($"/{_latestVersionGuid}-rbxPkgManifest.txt"); string pkgManifestUrl = Deployment.GetLocation($"/{_latestVersionGuid}-rbxPkgManifest.txt");

View File

@ -32,6 +32,10 @@ namespace Bloxstrap
public LaunchFlag StudioFlag { get; } = new("studio"); public LaunchFlag StudioFlag { get; } = new("studio");
public LaunchFlag VersionFlag { get; } = new("version");
public LaunchFlag ChannelFlag { get; } = new("channel");
#if DEBUG #if DEBUG
public bool BypassUpdateCheck => true; public bool BypassUpdateCheck => true;
#else #else
@ -87,6 +91,13 @@ namespace Bloxstrap
RobloxLaunchArgs = arg; RobloxLaunchArgs = arg;
startIdx = 1; startIdx = 1;
} }
else if (arg.StartsWith("version-"))
{
App.Logger.WriteLine(LOG_IDENT, "Got version argument");
VersionFlag.Active = true;
VersionFlag.Data = arg;
startIdx = 1;
}
} }
// parse // parse