protected bool DoBuild(KuinProjectNodeProperties kuinProperties, bool isReleaseMode) { IVsOutputWindowPane outPane = GetOutputWindowPane(); string commandLineArgs = kuinProperties?.CreateCommandLineArg(isReleaseMode); if (!Utilities.SaveDirtyFiles() || kuinProperties == null || outPane == null || string.IsNullOrEmpty(commandLineArgs)) { return(false); } if (!File.Exists(KuinclPath)) { MessageBox.Show( "Kuin compiler (kuincl.exe) path was not found: please set in 'Tool > Options > KuinStudio > Compiler Path'", "Kuin Studio", MessageBoxButton.OK, MessageBoxImage.Exclamation); return(false); } //ビルド using (var compileProcess = new Process() { StartInfo = new ProcessStartInfo() { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, StandardOutputEncoding = Encoding.Unicode, WorkingDirectory = kuinProperties.ActualWorkingDirectory, FileName = KuinclPath, Arguments = commandLineArgs, } }) { compileProcess.Start(); compileProcess.WaitForExit(); string res = string.Join("\n", "Start " + (isReleaseMode ? "Release" : "Debug") + " Build", "Command: " + KuinclPath + " " + commandLineArgs, compileProcess.StandardOutput.ReadToEnd()); outPane.Clear(); outPane.OutputString(res); outPane.Activate(); //kunncl output specification //0: success //non-0 (1): failure return(compileProcess.ExitCode == 0); } }
protected void RunProgram(KuinProjectNodeProperties kuinProperties) { string target = kuinProperties.BuildResultExePath; if (!File.Exists(target)) { return; } //cui -> do program and show "press any key to continue...", so user can check the result //gui/web -> just do it! if (kuinProperties.ApplicationType == KuinProjectNodeProperties.AppTypeCui) { new Process() { StartInfo = new ProcessStartInfo() { FileName = Environment.GetEnvironmentVariable("ComSpec"), Arguments = $"/c \"{target}\" & pause", WorkingDirectory = kuinProperties.ActualWorkingDirectory, } }.Start(); } else { new Process() { StartInfo = new ProcessStartInfo() { FileName = target, WorkingDirectory = kuinProperties.ActualWorkingDirectory, } }.Start(); } }