예제 #1
0
        /// <summary>
        /// Prompts for environment by looking into spreadsheet and listing them out
        /// to the console.
        /// </summary>
        /// <param name="source">The data source.</param>
        /// <param name="context">The preprocessing context.</param>
        /// <returns></returns>
        private static string PromptForEnvironment(DataSource source, PreprocessingContext context)
        {
            SettingsLoader loader = new SettingsLoader(context);

            Console.WriteLine("Environment name was not passed.");
            Console.WriteLine("");

            ConsoleUtils.WriteLine(ConsoleColor.Cyan, "These are the environment columns found in the spreadsheet:");

            List <string> environments = loader.GetEnvironments(source);

            for (int j = 0; j < environments.Count; j++)
            {
                ConsoleUtils.WriteLine(ConsoleColor.Cyan, string.Format(" {0} - {1}", j, environments[j]));
            }

            ConsoleUtils.Write(ConsoleColor.Cyan, "Type the environment # to use and press Enter: ");

            string environmentIndexString = Console.ReadLine();
            int    environmentIndex       = -1;

            if (int.TryParse(environmentIndexString, out environmentIndex))
            {
                return(environments[environmentIndex]);
            }

            return(null);
        }