private void LaunchChobby(SpringPaths paths, string internalName, string engineVersion) { var process = new Process { StartInfo = { CreateNoWindow = true, UseShellExecute = false } }; paths.SetDefaultEnvVars(process.StartInfo, engineVersion); process.StartInfo.FileName = paths.GetSpringExecutablePath(engineVersion); process.StartInfo.WorkingDirectory = Path.GetDirectoryName(paths.GetSpringExecutablePath(engineVersion)); process.StartInfo.Arguments = $"--menu \"{internalName}\""; process.Start(); }
private async Task LaunchChobby(SpringPaths paths, string internalName, string engineVersion, int loopbackPort) { process = new Process { StartInfo = { CreateNoWindow = true, UseShellExecute = false } }; paths.SetDefaultEnvVars(process.StartInfo, engineVersion); var widgetFolder = Path.Combine(paths.WritableDirectory);//, "LuaMenu", "Widgets"); if (!Directory.Exists(widgetFolder)) Directory.CreateDirectory(widgetFolder); File.WriteAllText(Path.Combine(widgetFolder, "chobby_wrapper_port.txt"), loopbackPort.ToString()); process.StartInfo.FileName = paths.GetSpringExecutablePath(engineVersion); process.StartInfo.WorkingDirectory = Path.GetDirectoryName(paths.GetSpringExecutablePath(engineVersion)); process.StartInfo.Arguments = $"--menu \"{internalName}\""; var tcs = new TaskCompletionSource<bool>(); process.Exited += (sender, args) => tcs.TrySetResult(true); process.EnableRaisingEvents = true; process.Start(); await tcs.Task; }