public void BotResultToVLCCommand(IBotResult botResult) { string prefix = "vlc:"; string vlcRawText = String.Empty; if (botResult.Text.Length > prefix.Length && botResult.Text.StartsWith(prefix)) { vlcRawText = botResult.Text.Substring(prefix.Length); } else { return; } vlcRawText = vlcRawText.Trim(); VLCCommand vlcCommand; switch (vlcRawText) { case "step volume up": case "step volumeup": vlcCommand = new VLCCommand(VLCCommandType.StepVolumeUp); break; case "step volume down": case "step volumedown": vlcCommand = new VLCCommand(VLCCommandType.StepVolumeDown); break; case "launch and connect": case "launchandconnect": vlcCommand = new VLCCommand(VLCCommandType.LaunchAndConnect); break; case "fast forward": case "fastforward": vlcCommand = new VLCCommand(VLCCommandType.FastForward); break; case "previous": case "prev": vlcCommand = new VLCCommand(VLCCommandType.Previous); break; default: vlcCommand = new VLCCommand(vlcRawText); Console.WriteLine("Bot result as RawText"); break; } hub.Publish <VLCCommand>(vlcCommand); }
static void Main(string[] args) { VLCRemote connector = new VLCRemote(); connector.Hub.Subscribe <IVLCResponse>(printResponse); Console.WriteLine("Menu"); Console.WriteLine("1. Play"); Console.WriteLine("2. Help"); Console.WriteLine("3. Next"); Console.WriteLine("4. Previous"); Console.WriteLine("5. Step Volume Up"); Console.WriteLine("6. Step Volume Down"); Console.WriteLine("7. Quit"); Console.WriteLine("8. Connect"); Console.WriteLine("9. Launch and connect"); Console.WriteLine("0. Pause"); Console.WriteLine("a. Stop"); while (true) { ConsoleKeyInfo response = Console.ReadKey(); VLCCommand command; switch (response.KeyChar) { case 'a': command = new VLCCommand(VLCCommandType.Stop); connector.Hub.Publish <VLCCommand>(command); break; case '0': command = new VLCCommand(VLCCommandType.Pause); connector.Hub.Publish <VLCCommand>(command); break; case '1': command = new VLCCommand(VLCCommandType.Play); connector.Hub.Publish <VLCCommand>(command); break; case '2': command = new VLCCommand(VLCCommandType.Help); connector.Hub.Publish <VLCCommand>(command); break; case '3': command = new VLCCommand(VLCCommandType.Next); connector.Hub.Publish <VLCCommand>(command); break; case '4': command = new VLCCommand(VLCCommandType.Previous); connector.Hub.Publish <VLCCommand>(command); break; case '5': command = new VLCCommand(VLCCommandType.StepVolumeUp); connector.Hub.Publish <VLCCommand>(command); break; case '6': command = new VLCCommand(VLCCommandType.StepVolumeDown); connector.Hub.Publish <VLCCommand>(command); break; case '7': command = new VLCCommand(VLCCommandType.Quit); connector.Hub.Publish <VLCCommand>(command); break; case '8': command = new VLCCommand(VLCCommandType.Connect); connector.Hub.Publish <VLCCommand>(command); break; case '9': command = new VLCCommand(VLCCommandType.LaunchAndConnect); connector.Hub.Publish <VLCCommand>(command); break; } } }