static void Main() { TxtPrinter.PrintInformation("WELCOME TO THE CHARACTER BUILDER PROGRAM -- WHICH IS A PRETTY NEAT PROGRAM!"); var keepLooping = true; while (keepLooping) { Console.WriteLine("Enter the number of the character that you want to build.\n"); var(characterBuilders, characterNames) = TypParser.GetInstantiatedTypeDictionaryAndNameList <AbstractCharacterBuilder>(); TxtParser.PrintStringList(characterNames); var choiceString = Console.ReadLine(); if (!TypParser.TryGetType(choiceString, characterBuilders, out var builder)) { Console.WriteLine(INVALID_CHOICE_MESSAGE); continue; } var character = CharacterMaker.GetCharacter(builder); DescribeCharacter(character); keepLooping = ContinuationDeterminer.GoAgain(); } }
static void Main(string[] args) { var keepLooping = true; var(topicDictionary, topicNames) = TypParser.GetInstantiatedTypeDictionaryAndNameList <IArguable>(); var topicContainer = Container.GetContainer(topicDictionary); TxtPrinter.PrintInformation("WELCOME TO THE ARGUMENT PROGRAM -- WHICH IS A PROGRAM THAT'S KIND OF FUN, AT LEAST AT FIRST MAYBE."); while (keepLooping) { var topic = GetTopic(topicNames, topicContainer); if (topic == null) { break; } Arguer.Topic = topic; switch (Argue(topic)) { case Choice.ChangeTopic: continue; default: keepLooping = false; break; } } }
static void Main(string[] args) { TxtPrinter.PrintInformation("WELCOME TO THE COMMAND PROGRAM - WHICH IS MILDLY THOUGHT-PROVOKING"); List <Item> items; try { using (var reader = new StreamReader(ConfigurableItemsPath)) { var json = reader.ReadToEnd(); items = JsonConvert.DeserializeObject <List <Item> >(json); } } catch (Exception ex) { Console.WriteLine($"Unable to retrieve item from '{ConfigurableItemsPath}'.\n" + $"Exception message: {ex.Message}\n" + $"Using default questions and answers instead.\n"); items = DefaultItems.GetDefaultItems(); } var(commandDict, _) = TypeParser.GetInstantiatedTypeDictionaryAndNameList <ICommand>(); var commandList = commandDict .OrderBy(c => c.Key) .Select(c => c.Value.Description) .ToList(); while (true) { var order = new Order(); while (true) { var commandChoice = Asker.GetChoiceFromList("What do you want to do with your order?", commandList) + 1; order = commandDict[commandChoice].Execute(order, items); if (!ContinuationDeterminer.GoAgain("Do you want to perform another action on your order?")) { break; } } if (!ContinuationDeterminer.GoAgain()) { Environment.Exit(0); } } }
static void Main(string[] args) { TxtPrinter.PrintInformation("WELCOME TO THE INTERPRETER METHOD PROGRAM -- WHICH MAY PROVIDE SOME INTEREST"); var(departmentDictionary, departmentList) = TypParser.GetInstantiatedTypeDictionaryAndNameList <AbstractHiringProcess>(); while (true) { var chosenIndex = Asker.GetChoiceFromList("For what department do you want to apply for a job?", departmentList); var chosenDepartment = departmentDictionary[++chosenIndex]; chosenDepartment.ExecuteHiringProcess(); if (!ContinuationDeterminer.GoAgain()) { Environment.Exit(0); } } }
static void Main(string[] args) { TxtPrinter.PrintInformation("WELCOME TO THE BRIDGE PROGRAM -- WHICH IS A BORING PROGRAM THAT SORT OF DOES CONVERSIONS"); var keepLooping = true; while (keepLooping) { var(converters, converterNames) = TypParser.GetTypeDictionaryAndNameList <AbstractConverter>(); Console.WriteLine("Enter the number of the measurement from which you want to convert."); TxtParser.PrintStringList(converterNames); var strConverterChoice = TxtParser.GetTextFromConsole(); if (!TypParser.TryGetType(strConverterChoice, converters, out var converter)) { Console.WriteLine(INVALID_CHOICE_MESSAGE); continue; } var(formatters, formatterNames) = TypParser.GetInstantiatedTypeDictionaryAndNameList <IFormatter>(); Console.WriteLine("Enter the number of the way you want the output formatted."); TxtParser.PrintStringList(formatterNames); var strFormatterChoice = TxtParser.GetTextFromConsole(); if (!TypParser.TryGetType(strFormatterChoice, formatters, out var formatter)) { Console.WriteLine(INVALID_CHOICE_MESSAGE); continue; } var instantiatedConverter = Activator.CreateInstance(converter, formatter) as AbstractConverter; Console.WriteLine("Enter the value that you want converted"); var strValue = TxtParser.GetTextFromConsole(); if (!decimal.TryParse(strValue, out var value)) { Console.WriteLine("That's not a value that can be converted. Let's try this again I guess."); continue; } instantiatedConverter.Convert(value); keepLooping = ContinuationDeterminer.GoAgain(); } }
static void Main(string[] args) { TxtPrinter.PrintInformation("WELCOME TO THE VISITOR PROGRAM -- WHICH MAY OFFER SOME CONSOLATION"); while (true) { var personalAspects = TypParser.GetInstantiatedTypeDictionaryAndNameList <IPersonalAspect>() .Item1.Select(kv => kv.Value).ToList(); var visitor = new SophisticationLevelVisitor(); foreach (var aspect in personalAspects) { aspect.SetAspect(); aspect.Accept(visitor); } Console.WriteLine($"Your level of sophistication is {visitor.GetSophisticationLevel()}."); if (!ContinuationDeterminer.GoAgain()) { Environment.Exit(0); } } }