public void Execute(string input) { if (input == "lol") { tempVal.WriteLine("You laugh. Tee Hee!"); } else { tempVal.WriteLine("You laugh at {0}. Tee Hee!", GetAllButFirstWord(input)); } }
public void Execute(string[] args) { var user = factory.CreateUserStore(); user.Authenticate(eConfig.UserName, eConfig.Password); var note = factory.CreateNoteStore(); string cmdName; if ((args.Count() > 0) == false) { cmdName = "today"; } else { cmdName = args[0].Trim().ToLower(); } var rest = args.Skip(1); var cmd = commands.FirstOrDefault(m => m.Name == cmdName); if (cmd == null) { console.WriteLine("Unknown Command"); } else { cmd.Execute(rest); } }
public void Execute(string input) { var output = GetAllButFirstWord(input); using (roomRepository) { var LookedAt = roomRepository.AsQueryable() .FirstOrDefault(qq => qq.RoomName == output); if (LookedAt == null) { console.WriteLine("It must be an item"); return; } console.WriteLine(LookedAt.Description); } }
public void Execute(string input) { var output = GetAllButFirstWord(input).ToUpper(); console.ForegroundColor = ConsoleColor.Red; console.WriteLine(output); console.ResetColor(); }
public void Execute(string input) { var output = GetAllButFirstWord(input); var name = output.Split('.')[0]; var itemNewName = string.Join("=", input.Trim().Split('=').Skip(1)).Trim(); using (repository) { var item = repository.AsQueryable() .FirstOrDefault(qq => qq.ItemName == name); if (item == null) { console.WriteLine("I do not recognize \"{0}\".", item); return; } console.WriteLine("The item's name has been changed from {0} to {1}.", item.ItemName, itemNewName); item.ItemName = itemNewName; } }
public void Execute(string input) { var output = GetAllButFirstWord(input); using (repository) { repository.Add(new Room() { RoomName = output }); } console.WriteLine("Room Created."); }
public void Loop() { field = inputs.GetUserInput(); field = fieldAlterations.GenerateField(field); while (true) { facade.Clear(); display.DrawGame(field); simulation.StartNewGen(field); display.WriteProperties(numOfIterations); numOfIterations++; if (Console.KeyAvailable) { var key = Console.ReadKey(true); if (key.Key == ConsoleKey.P) { facade.Clear(); facade.WriteLine(Texts.Pause); var answ = facade.ReadLine().ToLower(); if (texts.True(answ)) { file.Save(field); facade.WriteLine(Texts.Approval); continue; } else if (texts.False(answ)) { break; } else { continue; } } } } }
public void Execute(string input) { var output = GetAllButFirstWord(input); using (repository) { repository.Add(new Item() { ItemName = output, RoomId = 2 }); // RoomId 2 is the inventory "Room". } console.WriteLine("You create the item \"{0}\" in your inventory.", output); }
public void Execute(string input) { console.WriteLine("You are carrying:"); using (repository) { var sack = repository.AsQueryable().Where(qq => qq.RoomId == 2); foreach (var item in sack) { console.Write("{0} ", item.ItemName); } /* Reminder: RoomId 2 is the inventory "room". */ } }
public void DrawGame(Field field) { for (int currentRow = 0; currentRow < field.Height; currentRow++) { for (int currentColumn = 0; currentColumn < field.Width; currentColumn++) { var currentCell = field.Cells[currentRow, currentColumn]; if (currentCell) { facade.Write(Texts.Symbol); AddLiveCells(); } else { facade.Write(Texts.Empthy); } if (currentColumn == field.Width - 1) { facade.WriteLine(Texts.Return); } } } }
public void Execute(string input) { var output = GetAllButFirstWord(input); var name = output.Split('.')[0]; var itemDescription = string.Join("=", input.Trim().Split('=').Skip(1)).Trim(); using (repository) { var item = repository.AsQueryable() .FirstOrDefault(qq => qq.ItemName == name); if (item == null) { console.WriteLine("I do not recognize \"{0}\".", item); return; } item.ItemDescription = itemDescription; } }
public void Run() { while (true) { console.Write(">> "); var input = console.ReadLine(); if (input == "exit") { break; } if (command.IsValid(input)) { command.Execute(input); } else { console.WriteLine(input); } } }
public void DrawAnimals(Field field, List <Animal> additionalAnimal) { for (int currentRow = 0; currentRow < field.Height; currentRow++) { for (int currentColumn = 0; currentColumn < field.Width; currentColumn++) { var currentAnimal = _genericAnimal.FindInField(field, currentColumn, currentRow); if (currentAnimal == null) { _facade.Write(TextParameters.Empty); } else if (currentAnimal.Alive) { _facade.Write(currentAnimal.Symbol); } if (currentColumn == field.Width - 1) { _facade.WriteLine(TextParameters.Return); } } } }
public Field GetUserInput() { facade.WriteLine(Texts.Intro); facade.WriteLine(); facade.WriteLine(Texts.StartFromSaved); var answ = facade.ReadLine().ToLower(); if (validation.ValidateQuestion(answ)) { field = fileWorker.Load(); return(field); } else if (!validation.ValidateQuestion(answ)) { facade.WriteLine(Texts.Param); facade.WriteLine(Texts.Height); inputHeight = facade.ReadLine(); facade.WriteLine(Texts.Width); inputWidth = facade.ReadLine(); var validH = validation.ValidateInt(inputHeight); var validW = validation.ValidateInt(inputWidth); if (validH && validW) { field = CreateInputField(inputHeight, inputWidth); return(field); } else { facade.WriteLine(Texts.Error); GetUserInput(); return(field); } } return(field); }
public void Execute(string input) { console.WriteLine(GetAllButFirstWord(input)); }
public void Execute(string input) { storage.WriteLine("You wave at {0}.", GetAllButFirstWord(input)); }
public void Execute(string input) { console.WriteLine("You open the {0} and peek at what's inside.", GetAllButFirstWord(input)); }
public void Execute(string input) { console.WriteLine("You gracefully dance the {0}.", GetAllButFirstWord(input)); }
public void Execute(string input) { console.WriteLine("You dance around like a fool"); }
public void Execute(string input) { var output = GetAllButFirstWord(input); storage.WriteLine("One look at {0} sends you into a panic.", output); }
public void Execute(string input) { var output = GetAllButFirstWord(input); storage.WriteLine("You bonk {0} on the head. Ouch!", output); }
public void HandleUnknownInput(string input) { storage.WriteLine("I don't understand."); }
public void Execute(string input) { console.WriteLine("You examine the {0}.", GetAllButFirstWord(input)); }
public void Execute(string input) { var output = GetAllButFirstWord(input); console.WriteLine(output); }
public void Execute(string input) { console.WriteLine("You slap {0} upside the head.", GetAllButFirstWord(input)); }
public void Execute(string input) { console.WriteLine("You make a rude comment to {0}.", GetAllButFirstWord(input)); }
public void Execute(string input) { console.WriteLine("You cheer for {0}.", GetAllButFirstWord(input)); }
public void Execute(string input) { var output = GetAllButFirstWord(input); storage.WriteLine(String.Format("You fix {0} with a baleful glare.", output)); }
public void Execute(string input) { var output = GetAllButFirstWord(input); storage.WriteLine(String.Format("You shake your fist at {0} in anger.", output)); }
public void Execute(string input) { var output = GetAllButFirstWord(input); storage.WriteLine("You gracefully dance the {0}.", output); }