Пример #1
0
        public async Task <bool> Handle(FindItemCommand request, CancellationToken cancellationToken)
        {
            var text = await clipboardProvider.Copy();

            var item = await mediator.Send(new ParseItemCommand(text));

            if (item != null)
            {
                var clipboardContents = await clipboardProvider.GetText();

                await clipboardProvider.SetText(item.Name);

                keybindsProvider.PressKey("Ctrl+F");
                keybindsProvider.PressKey("Ctrl+A");
                keybindsProvider.PressKey("Paste");
                keybindsProvider.PressKey("Enter");

                await Task.Delay(100);

                await clipboardProvider.SetText(clipboardContents);

                return(true);
            }

            return(false);
        }
Пример #2
0
        public async Task <Unit> Handle(WriteChatCommand request, CancellationToken cancellationToken)
        {
            string clipboardValue = null;

            if (settings.RetainClipboard)
            {
                clipboardValue = await clipboard.GetText();
            }

            await clipboard.SetText(request.Message);

            keybindsProvider.PressKey("Enter");
            keybindsProvider.PressKey("Ctrl+A");
            keybindsProvider.PressKey("Paste");
            keybindsProvider.PressKey("Enter");
            keybindsProvider.PressKey("Enter");
            keybindsProvider.PressKey("Up");
            keybindsProvider.PressKey("Up");
            keybindsProvider.PressKey("Esc");

            if (settings.RetainClipboard)
            {
                await Task.Delay(100);

                await clipboard.SetText(clipboardValue);
            }

            return(Unit.Value);
        }
Пример #3
0
        public async Task <string> Copy()
        {
            var clipboardText = string.Empty;

            if (settings.RetainClipboard)
            {
                clipboardText = await TextCopy.ClipboardService.GetTextAsync();

                if (clipboardText == null)
                {
                    clipboardText = string.Empty;
                }
            }

            await SetText(string.Empty);

            keybindsProvider.PressKey("Copy");

            await Task.Delay(100);

            // Retrieve clipboard.
            var result = await TextCopy.ClipboardService.GetTextAsync();

            if (settings.RetainClipboard)
            {
                await Task.Delay(100);

                await TextCopy.ClipboardService.SetTextAsync(clipboardText);
            }

            return(result);
        }
        public Task <bool> Handle(ScrollStashDownCommand request, CancellationToken cancellationToken)
        {
            if (!nativeProcess.IsPathOfExileInFocus)
            {
                return(Task.FromResult(false));
            }

            keybindsProvider.PressKey("Right");
            return(Task.FromResult(true));
        }
Пример #5
0
 private void GetKeybindTask(string keybind, string input, Task <bool> task)
 {
     // We need to make sure some key combinations make it into the game no matter what
     if (task != null && input == keybind)
     {
         Task.Run(async() =>
         {
             if (!await task)
             {
                 Enabled = false;
                 keybindsProvider.PressKey(keybind);
                 await Task.Delay(200);
                 Enabled = true;
             }
         });
     }
 }