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
);
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();
}
@ -310,23 +315,32 @@ namespace Bloxstrap
if (!Deployment.IsDefaultChannel)
App.SendStat("robloxChannel", Deployment.Channel);
ClientVersion clientVersion;
try
if (!App.LaunchSettings.VersionFlag.Active || string.IsNullOrEmpty(App.LaunchSettings.VersionFlag.Data))
{
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}");
Deployment.Channel = Deployment.DefaultChannel;
clientVersion = await Deployment.GetInfo();
App.Logger.WriteLine(LOG_IDENT, $"Version set to {App.LaunchSettings.VersionFlag.Data} from arguments");
_latestVersionGuid = App.LaunchSettings.VersionFlag.Data;
}
key.SetValueSafe("www.roblox.com", Deployment.IsDefaultChannel ? "" : Deployment.Channel);
_latestVersionGuid = clientVersion.VersionGuid;
_latestVersionDirectory = Path.Combine(Paths.Versions, _latestVersionGuid);
string pkgManifestUrl = Deployment.GetLocation($"/{_latestVersionGuid}-rbxPkgManifest.txt");

View File

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