protected void HandleKeystroke() { if (string.IsNullOrEmpty(settings.Command)) { return; } if (settings.Command.Length == 1) // 1 Character is fine { return; } var macro = CommandTools.ExtractMacro(settings.Command, 0); if (string.IsNullOrEmpty(macro)) // Not a macro, save only first character { settings.Command = settings.Command[0].ToString(); SaveSettings(); } else { if (settings.Command != macro) // Save only one keystroke { settings.Command = macro; SaveSettings(); } } }
protected async void SendInput(string inputText) { InputRunning = true; await Task.Run(() => { var text = inputText; for (var idx = 0; idx < text.Length && !ForceStop; idx++) { var macro = CommandTools.ExtractMacro(text, idx); idx += macro.Length - 1; macro = macro.Substring(1, macro.Length - 2); HandleMacro(macro); } }); InputRunning = false; }