public static void Main(string[] args) { ConsoleOutputWorker.OutputSolutionFilePath(); string solutionFilePath = Console.ReadLine(); ConsoleOutputWorker.OutputProjectPath(); List <string> projectDirectories = Console.ReadLine().Split(',').ToList(); /* Check if entered paths are empty. */ ValidationHelper.ValidateEmptyInputs(solutionFilePath, projectDirectories, args); /* Check whether to append the projects to existing solution file or to create a new solution file. */ bool isAppend = FileHelper.CheckIfAppend(); /* Check if entered solution file path is valid. If not valid, create the solution path in "temp" folder */ if (!ValidationHelper.ValidateProperFilePath(solutionFilePath)) { solutionFilePath = FileHelper.GetTempSolutionPath(); } /* Include any projects inside solution's own directory. */ DirectoryHelper.AddCurrentSolutionDirectory(projectDirectories, solutionFilePath); /* Create solution file with all the projects at the specified location */ FileWorker.CreateSolutionFile(solutionFilePath, projectDirectories, isAppend); }
/// <summary> /// Checks if there are valid projects at the specified location /// </summary> /// <param name="fileInfo"></param> public static void ValidateFileInfo(FileInfo[] fileInfo, string directoryPath) { if (fileInfo.Count() == 0) { ConsoleOutputWorker.OutputNoProjectsStatements(directoryPath); } }
public static bool CheckIfAppend() { bool isAppend = false; ConsoleOutputWorker.OutputIsAppendStatements(); isAppend = Console.ReadLine().ToLower() == "a" ? true : false; return(isAppend); }
/// <summary> /// Checks if entered paths are empty. /// </summary> /// <param name="solutionFilePath"></param> /// <param name="projectDirectories"></param> /// <returns></returns> public static void ValidateEmptyInputs(string solutionFilePath, List <string> projectDirectories, string[] args) { if (string.IsNullOrEmpty(solutionFilePath) || projectDirectories.Count == 0) { ConsoleOutputWorker.OutputPathsEmptyStatements(); if (Console.ReadLine().ToLower() == "c") { Program.Main(args); } else { Environment.Exit(0); } } }