private static ExecutionEnvironment LoadEnvironment(string[] args) { ExecutionEnvironment result = new ExecutionEnvironment(); if (args.Length == 0) { DirectoryInfo parentDir = new DirectoryInfo(@"C:\Downloads"); var srcDirectories = parentDir.GetDirectories("SRC_D3 Main*"); if (srcDirectories.Length == 1) { result.WorkingDirectory = srcDirectories[0].FullName; } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Unable to find source code directory."); Console.ReadLine(); Environment.Exit(0); } } else { result.WorkingDirectory = args[0].TrimStart('\"').TrimEnd('\"'); } return result; }
public override void Apply(ExecutionEnvironment env) { var pathToDelete = Path.Combine(env.WorkingDirectory, FolderPath); if (Directory.Exists(pathToDelete)) { Directory.Delete(pathToDelete, true); Console.WriteLine("Deleted folder \"{0}\"", FolderPath); } }
public override void Apply(ExecutionEnvironment env) { string filePath = Path.Combine(env.WorkingDirectory, FilePath); if (File.Exists(filePath)) { File.Delete(filePath); Console.WriteLine("Deleted file \"{0}\"", FilePath); } }
public override void Apply(ExecutionEnvironment env) { var sln = File.ReadAllLines(Path.Combine(env.WorkingDirectory, @"sln\DynamicDataDisplay\DynamicDataDisplay.sln")).ToList(); string guid = ""; for (int i = 0; i < sln.Count; i++) { var line = sln[i]; if (line.StartsWith("Project")) { var subLine = line.Substring(53); var lineParts = subLine.Split('"'); var name = lineParts[0]; guid = lineParts[4]; if (name == ProjectName) { sln.RemoveAt(i); sln.RemoveAt(i); break; } } } if (guid == "") { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Project \"{0}\" not found.", ProjectName); Console.ForegroundColor = ConsoleColor.White; return; } int j = 0; while (j < sln.Count) { var line = sln[j]; if (line.Contains(guid)) { sln.RemoveAt(j); } else { j++; } } File.WriteAllLines(Path.Combine(env.WorkingDirectory, @"sln\DynamicDataDisplay\DynamicDataDisplay.sln"), sln.ToArray()); Console.WriteLine("Removed project \"{0}\"", ProjectName); }
public override void Apply(ExecutionEnvironment env) { DirectoryInfo dir = new DirectoryInfo(env.WorkingDirectory); DeleteFolderRecursively(dir); }
public override void Apply(ExecutionEnvironment env) { Console.WriteLine(); }
public abstract void Apply(ExecutionEnvironment env);