- tweak: fix resolving think

This commit is contained in:
2025-01-07 17:01:00 +03:00
parent 8619e248fd
commit 99312d38a8
12 changed files with 286 additions and 105 deletions

View File

@@ -10,18 +10,8 @@ public sealed class RunnerService(
ConfigurationService varService,
FileService fileService,
EngineService engineService,
AssemblyService assemblyService,
AuthService authService,
PopupMessageService popupMessageService,
CancellationService cancellationService)
: IRedialApi
AssemblyService assemblyService)
{
public async Task PrepareRun(RobustUrl url)
{
var buildInfo = await contentService.GetBuildInfo(url, cancellationService.Token);
await PrepareRun(buildInfo, cancellationService.Token);
}
public async Task PrepareRun(RobustBuildInfo buildInfo, CancellationToken cancellationToken)
{
debugService.Log("Prepare Content!");
@@ -67,60 +57,4 @@ public sealed class RunnerService(
await Task.Run(() => loader.Main(args), cancellationToken);
}
public async Task RunGame(string urlraw)
{
var url = new RobustUrl(urlraw);
using var cancelTokenSource = new CancellationTokenSource();
var buildInfo = await contentService.GetBuildInfo(url, cancelTokenSource.Token);
var account = authService.SelectedAuth;
if (account is null)
{
popupMessageService.Popup("Error! Auth is required!");
return;
}
if (buildInfo.BuildInfo.Auth.Mode != "Disabled")
{
Environment.SetEnvironmentVariable("ROBUST_AUTH_TOKEN", account.Token.Token);
Environment.SetEnvironmentVariable("ROBUST_AUTH_USERID", account.UserId.ToString());
Environment.SetEnvironmentVariable("ROBUST_AUTH_PUBKEY", buildInfo.BuildInfo.Auth.PublicKey);
Environment.SetEnvironmentVariable("ROBUST_AUTH_SERVER", account.AuthLoginPassword.AuthServer);
}
var args = new List<string>
{
// Pass username to launched client.
// We don't load username from client_config.toml when launched via launcher.
"--username", account.AuthLoginPassword.Login,
// Tell game we are launcher
"--cvar", "launch.launcher=true"
};
var connectionString = url.ToString();
if (!string.IsNullOrEmpty(buildInfo.BuildInfo.ConnectAddress))
connectionString = buildInfo.BuildInfo.ConnectAddress;
// We are using the launcher. Don't show main menu etc..
// Note: --launcher also implied --connect.
// For this reason, content bundles do not set --launcher.
args.Add("--launcher");
args.Add("--connect-address");
args.Add(connectionString);
args.Add("--ss14-address");
args.Add(url.ToString());
debugService.Debug("Connect to " + url.ToString() + " " + account.AuthLoginPassword.AuthServer);
await Run(args.ToArray(), buildInfo, this, cancelTokenSource.Token);
}
public async void Redial(Uri uri, string text = "")
{
//await RunGame(uri.ToString());
}
}