public static void RespondToCommand() { write = RespondReader[CommandCounter]; ResetCursor(); Console.WriteLine(write); TTS.speech(write); Thread.Sleep(3000); }
public static void start() { while (true) { write = string.Empty; Console.CursorVisible = true; write = "Write Command, Write '?' to see a list of commands."; ResetCursor(); Console.CursorTop -= 4; Console.WriteLine(write); TTS.speech(write); MiddleLeft(""); MiddleTop(); Input = Console.ReadLine().ToLower(); ListenToCommand(); } }
public static void CreateCommand() { Console.CursorVisible = true; ResetCursor(); write = "How do you want me to respond to this command?"; Console.WriteLine(write); TTS.speech(write); MiddleLeft(write); write = "Leave empty to cancel"; Console.WriteLine(write); TTS.speech(write); string Respond = Console.ReadLine().ToLower(); if (Respond != "") { ListenReader.Add(Input); File.WriteAllLines(ListenPath, ListenReader.ToArray()); RespondReader.Add(Respond); File.WriteAllLines(RespondPath, RespondReader.ToArray()); } }
public static void CommandList(string i) { switch (Program.Input) { case "?": case "help": { Program.write = "These are all the available commands and actions, press any key to continue"; Program.ResetCursor(); Console.CursorTop = 0; Console.WriteLine(Program.write); TTS.speech(Program.write); Console.SetCursorPosition(0, 2); for (int x = 0; x < Program.ListenReader.Count; x++) { Console.CursorLeft = 0; Console.Write(Program.ListenReader[x]); Console.Write("\r\n"); } Console.SetCursorPosition(Console.WindowWidth / 2 + 10, 2); for (int x = 0; x < Program.RespondReader.Count; x++) { Console.CursorLeft = Console.WindowWidth / 2; Console.Write(Program.RespondReader[x]); Console.Write("\r\n"); } Console.WriteLine("\r\n"); for (int x = 0; x < Program.RespondReader.Count; x++) { Console.CursorLeft = Console.WindowWidth / 2; Console.Write(Program.RespondReader[x]); Console.Write("\r\n"); } Console.ReadKey(); break; } default: { for (Program.CommandCounter = 0; Program.CommandCounter < Program.ListenReader.Count; Program.CommandCounter++) { if (Program.ListenReader[Program.CommandCounter] == Program.Input) { Program.CommandExists = true; Program.RespondToCommand(); } /* * else * { * CommandCounter++; * } */ } if (!Program.CommandExists) { Program.CreateCommand(); } break; } } }