private void PraseCommand(AssistantBot assistant, Command command, RecognitionResult result) { foreach (CustomCommand cmd in _customCommands) { if (command.MatchById(cmd.id)) { foreach (string line in cmd.instructionLines) { if (line.StartsWith("-s")) { assistant.Speak(line.Substring(3, line.Length - 4)); } if (line.StartsWith("-o")) { try { System.Diagnostics.Process.Start(line.Substring(3, line.Length - 4)); } catch (Exception ex) { assistant.Speak("I couldn't find what you wannted to open. Be sure you provided a link, or a valid path in the custom command " + cmd.name); } } if (line.StartsWith("-w")) { Thread.Sleep(Convert.ToInt32(line.Substring(3, line.Length - 4))); } } return; } } }
private void ReadCommands(AssistantBot assistant) { string cmdId; string cmdName; string cmdDescription; List <string> cmdLines; for (int i = 0; i <= _commandsPath.Length - 1; ++i) { if (!_commandsPath[i].EndsWith(".arts")) { continue; } cmdLines = new List <string>(); string[] commandLineContents = File.ReadAllLines(_commandsPath[i]); cmdId = cmdId = "0" + (300001 + i).ToString(); cmdName = commandLineContents[1]; cmdDescription = commandLineContents[2]; for (int j = 3; j < commandLineContents.Length; ++j) { cmdLines.Add(commandLineContents[j]); } _customCommands.Add(new CustomCommand(cmdId, cmdName, cmdDescription, cmdLines)); } GrammarManager.GenerateGrammar(_grammarPath, _customCommands); }
public GitConfigurationPanel(AssistantBot assistant) { InitializeComponent(); _repositoryPath = null; _assistant = assistant; _repositoriesFile = Path.Combine(Environment.CurrentDirectory, "Repositories.txt"); }
public CustomCommandService(AssistantBot assistant) { _grammarPath = Path.Combine(Directory.GetCurrentDirectory(), "Grammars\\CustomCommandsServices.grxml"); _commandsDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), "CustomCommands"); _commandsPath = Directory.GetFiles(_commandsDirectoryPath); _customCommands = new List <CustomCommand>(); ReadCommands(assistant); RegisterAfiliateCommands(); }
public GitService(AssistantBot assistant) { _repositories = new Dictionary <string, Repository>(); _repositoriesFilePath = Path.Combine(Environment.CurrentDirectory, "Repositories.txt"); _grammarPath = Path.Combine(Environment.CurrentDirectory, @"Grammars\GitServices.xml"); RegisterAfiliateCommands(); RegisterRepositories(); GenerateGrammar(); }
public CodeSupportService(AssistantBot assistant) { _presetsDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), "Presets"); _grammarPath = Path.Combine(Directory.GetCurrentDirectory(), "Grammars\\CodeSupportServices.xml"); _presetsPath = Directory.GetFiles(_presetsDirectoryPath); _presetsHandle = new string[_presetsPath.Length]; LoadPresets(); RegisterAfiliateCommands(); _assistant = assistant; }
public MainForm() { InitializeComponent(); _Artemis = new AssistantBot(this); this.FormBorderStyle = FormBorderStyle.None; Rectangle workingArea = Screen.GetWorkingArea(this); this.Location = new Point(workingArea.Right - Size.Width, workingArea.Top); InitializeKeyWordRecognizer(); this.FormClosed += (sender, e) => notifyIcon.Visible = false; }
public SpeechListener(AssistantBot parent) { try { _assistant = parent; _speechRecognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US")); _speechRecognizer.SetInputToDefaultAudioDevice(); _speechRecognizer.SpeechRecognized += SpeechRecognized; _speechRecognizer.SpeechRecognized += _assistant.OnRecognition; _speechRecognizer.SpeechHypothesized += (o, e) => { _assistant.formControl.UpdateSpeechHypothesis(e.Result.Text); }; _grammarsPath = Path.Combine(Directory.GetCurrentDirectory(), "Grammars"); string[] grammars = Directory.GetFiles(_grammarsPath); for (int i = 0; i < grammars.Length; ++i) { _speechRecognizer.LoadGrammar(new Grammar(grammars[i])); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Loading Grammars", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public NotificationManager(AssistantBot assistant) { _assistant = assistant; }
public void Execute(AssistantBot assistant, RecognitionResult result) => _commandAction(assistant, this, result);
public CommandManager(AssistantBot parent) { _assistant = parent; InitializeServices(); }
public SmallTalkService(AssistantBot assistant) { _afiliateCommands = new List <Command>(); _randomizer = new Random(); RegisterAfiliateCommands(); }
public CustomCommandPanel(AssistantBot assistant) { InitializeComponent(); _customCommands = new List <CustomCommandUIWrapper>(); _assistant = assistant; }
public TimeAndAgendaService(AssistantBot assistant) { _afiliateCommands = new List <Command>(); RegisterAfiliateCommands(); assistant.formControl.timer.Tick += TimeEventListener; }