mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
refactor: launch roblox using protocol string
This commit is contained in:
parent
f7fb08cff6
commit
c7bb481432
@ -315,7 +315,10 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
_launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString());
|
_launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString());
|
||||||
|
|
||||||
_launchCommandLine += " -channel ";
|
if (_launchCommandLine.StartsWith("roblox-player:1"))
|
||||||
|
_launchCommandLine += "+channel:";
|
||||||
|
else
|
||||||
|
_launchCommandLine += " -channel ";
|
||||||
|
|
||||||
if (App.Settings.Prop.Channel.ToLowerInvariant() == RobloxDeployment.DefaultChannel.ToLowerInvariant())
|
if (App.Settings.Prop.Channel.ToLowerInvariant() == RobloxDeployment.DefaultChannel.ToLowerInvariant())
|
||||||
_launchCommandLine += "production";
|
_launchCommandLine += "production";
|
||||||
|
@ -7,46 +7,19 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
static class ProtocolHandler
|
static class ProtocolHandler
|
||||||
{
|
{
|
||||||
// map uri keys to command line args
|
|
||||||
private static readonly IReadOnlyDictionary<string, string> UriKeyArgMap = new Dictionary<string, string>()
|
|
||||||
{
|
|
||||||
// excluding roblox-player and launchtime
|
|
||||||
{ "launchmode", "--" },
|
|
||||||
{ "gameinfo", "-t " },
|
|
||||||
{ "placelauncherurl", "-j "},
|
|
||||||
{ "launchtime", "--launchtime=" },
|
|
||||||
{ "browsertrackerid", "-b " },
|
|
||||||
{ "robloxLocale", "--rloc " },
|
|
||||||
{ "gameLocale", "--gloc " },
|
|
||||||
{ "channel", "-channel " }
|
|
||||||
};
|
|
||||||
|
|
||||||
public static string ParseUri(string protocol)
|
public static string ParseUri(string protocol)
|
||||||
{
|
{
|
||||||
string[] keyvalPair;
|
var args = new Dictionary<string, string>();
|
||||||
string key;
|
|
||||||
string val;
|
|
||||||
bool channelArgPresent = false;
|
bool channelArgPresent = false;
|
||||||
|
|
||||||
StringBuilder commandLine = new();
|
|
||||||
|
|
||||||
foreach (var parameter in protocol.Split('+'))
|
foreach (var parameter in protocol.Split('+'))
|
||||||
{
|
{
|
||||||
if (!parameter.Contains(':'))
|
if (!parameter.Contains(':'))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
keyvalPair = parameter.Split(':');
|
var kv = parameter.Split(':');
|
||||||
key = keyvalPair[0];
|
string key = kv[0];
|
||||||
val = keyvalPair[1];
|
string val = kv[1];
|
||||||
|
|
||||||
if (!UriKeyArgMap.ContainsKey(key) || string.IsNullOrEmpty(val))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (key == "launchmode" && val == "play")
|
|
||||||
val = "app";
|
|
||||||
|
|
||||||
if (key == "placelauncherurl")
|
|
||||||
val = HttpUtility.UrlDecode(val);
|
|
||||||
|
|
||||||
// we'll set this before launching because for some reason roblox just refuses to launch if its like a few minutes old so ???
|
// we'll set this before launching because for some reason roblox just refuses to launch if its like a few minutes old so ???
|
||||||
if (key == "launchtime")
|
if (key == "launchtime")
|
||||||
@ -61,13 +34,14 @@ namespace Bloxstrap
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandLine.Append(UriKeyArgMap[key] + val + " ");
|
args.Add(key, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!channelArgPresent)
|
if (!channelArgPresent)
|
||||||
EnrollChannel(RobloxDeployment.DefaultChannel);
|
EnrollChannel(RobloxDeployment.DefaultChannel);
|
||||||
|
|
||||||
return commandLine.ToString();
|
var pairs = args.Select(x => x.Key + ":" + x.Value).ToArray();
|
||||||
|
return String.Join("+", pairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChangeChannel(string channel)
|
public static void ChangeChannel(string channel)
|
||||||
|
Loading…
Reference in New Issue
Block a user