public static void GenerateProviders() { GenerateHelper.CheckIfDirectoryIsValid(); var valid = GenerateHelper.ValidPaths.First(x => x.Key.Equals(Program.CurrentDirectory)).Value; if (!valid) { GenerateHelper.NotValidDirectory(); return; } var tab = " "; var createProviders = new List <Tuple <string, string, bool> >(); var directories = Directory.GetDirectories(Program.CurrentDirectory); var dd = directories.First(x => x.Contains(".DAL", StringComparison.InvariantCultureIgnoreCase)); var pd = directories.First(x => x.Contains(".Providers", StringComparison.InvariantCultureIgnoreCase)); var modelPath = $"{(dd.EndsWith("\\") ? dd : $"{dd}\\")}Models";
public static void Action(string command) { command = command.Trim(); if (string.IsNullOrWhiteSpace(command)) { EmptyLine(); } var tab = Constants.vbTab; var actions = command.Split(' ') .Where(x => !string.IsNullOrWhiteSpace(x)) .ToList(); var actionsByQuotes = command.Split('"') .Where(x => !string.IsNullOrWhiteSpace(x)) .ToList(); if (!actions.Any()) { EmptyLine(); return; } if (command.Contains('"')) { actions = new List <string> { actions.First() }; var newParameters = actionsByQuotes.Where(para => !para.Trim().Equals(actions.First())); actions.AddRange(newParameters); } switch (actions.First().ToLower()) { case "cd": DirectoryHelper.UpdateDirectory(actions); return; case "ls": DirectoryHelper.ShowFilesInDirectory(); return; case "generate": GenerateHelper.Actions(actions); return; case "clear": Console.Clear(); WelcomeMessage(); return; case "quit": case "exit": Environment.Exit(1); return; case "help": WriteTitle("Overview of all available commands:"); var longestLength = Actions .OrderByDescending(x => x.Item1.Length) .First().Item1.Length; foreach (var action in Actions.Where(m => !m.Item3)) { Console.Write(" - "); Console.ForegroundColor = ConsoleColor.Magenta; var label = action.Item1; while (label.Length < longestLength) { label += " "; } Console.Write(label); Console.ResetColor(); Console.WriteLine($" {tab} {action.Item2}"); } WriteTitle("Overview of all available modules:"); foreach (var action in Actions.Where(m => m.Item3)) { Console.Write(" - "); Console.ForegroundColor = ConsoleColor.Magenta; var label = action.Item1; while (label.Length < longestLength) { label += " "; } Console.Write(label); Console.ResetColor(); Console.WriteLine($" {tab} {action.Item2}"); } Console.WriteLine(string.Empty); EmptyLine(); return; default: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("> The system does not recognize your specified command"); Console.ResetColor(); EmptyLine(); return; } }