private static int RunRemove(RemoveOptions options) { var file = Path.Combine(Directory.GetCurrentDirectory(), options.File); if (System.IO.File.Exists(file)) { var solution = LoadSolution(options); var project = FindProject(solution, options.Project); if (project != null) { // todo normalize paths. var currentFile = project.Items.OfType <ISourceFile>().Where(s => s.FilePath.Normalize() == options.File.Normalize()).FirstOrDefault(); if (currentFile != null) { project.Items.RemoveAt(project.Items.IndexOf(currentFile)); project.Save(); Console.WriteLine("File removed."); return(1); } Console.WriteLine("File not found in project."); return(-1); } Console.WriteLine("Project not found."); return(-1); } Console.WriteLine("File not found."); return(-1); }
private static int RunRemove(RemoveOptions options) { var file = Path.Combine(Directory.GetCurrentDirectory(), options.File); if (System.IO.File.Exists(file)) { var solution = LoadSolution(options); var project = FindProject(solution, options.Project); if (project != null) { // todo normalize paths. var currentFile = project.Items.OfType<ISourceFile>().Where(s => s.FilePath.Normalize() == options.File.Normalize()).FirstOrDefault(); if (currentFile != null) { project.Items.RemoveAt(project.Items.IndexOf(currentFile)); project.Save(); Console.WriteLine("File removed."); return 1; } Console.WriteLine("File not found in project."); return -1; } Console.WriteLine("Project not found."); return -1; } Console.WriteLine("File not found."); return -1; }