public void DeleteBuild() { var root = MainWindow.GetNightlyRoot(); if (!Directory.Exists(root) || MessageBox.Show(MainWindow, "Delete \"" + root + "\" folder?", "Confirm delete", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } using (var deleteWindow = new DeleteWindow(root)) { deleteWindow.ShowDialog(); } }
public void DeleteBuild() { var buildRoot = MainWindow.GetBuildRoot(); if (!Directory.Exists(buildRoot) || MessageBox.Show(MainWindow, "Delete \"" + buildRoot + "\" folder?", "Confirm delete", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } using (var deleteWindow = new DeleteWindow(buildRoot)) { deleteWindow.ShowDialog(); } MainWindow.ButtonDeleteBuild.Enabled = Directory.Exists(buildRoot); }
// Called on UI thread. private void RunNext() { UpdateLog(); if (NextCommand > 0 && FinishedOneCommand != null) FinishedOneCommand(); while (NextCommand < _commands.Count) { var line = _commands[NextCommand++]; // Handle comment line. if (line.StartsWith("#")) { Log(Environment.NewLine + line); continue; } // Execute a command. Log("> " + line); UpdateLog(); // Break apart arguments on space boundaries, but allow // quoted arguments to contain spaces. var parts = line.Split(' '); var words = new List<string>(); for (int i = 0; i < parts.Length; i++) { var word = parts[i]; if (word.StartsWith("\"") && !word.EndsWith("\"")) { while (++i < parts.Length) { word += " " + parts[i]; if (parts[i].EndsWith("\"")) break; } } words.Add(word); } var command = words[0].Trim('"'); words.RemoveAt(0); var args = String.Join(" ", words); // Specify a working directory other than the default. if (command == "cd") { _workingDirectory = words[0].Trim('"'); } // Remove a directory. else if (command == "rmdir") { if (words[0] == "/s") words.RemoveAt(0); var deleteDir = words[0].Trim('"'); if (Directory.Exists(deleteDir)) { using (var deleteWindow = new DeleteWindow(deleteDir)) { deleteWindow.ShowDialog(); } if (Directory.Exists(deleteDir)) { CommandsDone(false); return; } } } // Run a command in a separate process. else { try { StartProcess( command, args, _workingDirectory); } catch (Exception e) { Log(Environment.NewLine + "!!!! COMMAND FAILED !!!! " + e); } _workingDirectory = DefaultDirectory; return; } } CommandsDone(true); }