private async Task PrepareForRunInternal(Lifetime lifetime, IUnitTestRun run) { var unityEditorProcessId = myUnityController.TryGetUnityProcessId(); if (unityEditorProcessId.HasValue) { return; } var message = string.Format(StartUnityEditorQuestionMessage, myAvailableProviders[run.HostController.HostId], myUnityController.GetPresentableUnityVersion()); if (!MessageBox.ShowYesNo(message, PluginName)) { throw new Exception(string.Format(NotAvailableUnityEditorMessage, myAvailableProviders[run.HostController.HostId])); } var startUnityTask = StartUnity(lifetime); await myShellLocks.Tasks.YieldToIfNeeded(lifetime, Scheduling.MainGuard); ShowProgress(lifetime, startUnityTask); await startUnityTask.ConfigureAwait(false); }
private Task StartUnityIfNeed(Lifetime lifetime) { var message = string.Format(StartUnityEditorQuestionMessage, TaskRunnerName, myUnityController.GetPresentableUnityVersion()); var needStart = MessageBox.ShowYesNo(message, PluginName); if (!needStart) { throw new Exception(string.Format(NotAvailableUnityEditorMessage, TaskRunnerName)); } var commandLines = myUnityController.GetUnityCommandline(); var unityPath = commandLines.First(); var unityArgs = string.Join(" ", commandLines.Skip(1)); var process = new Process { StartInfo = new ProcessStartInfo(unityPath, unityArgs) }; process.Start(); return(myUnityController.WaitConnectedUnityProcessId(lifetime)); }