コード例 #1
0
ファイル: MouseLurker.cs プロジェクト: bopodada/Poe-Lurker
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async void ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                this._simulator.Keyboard.ModifiedKeyStroke(WindowsInput.Native.VirtualKeyCode.CONTROL, WindowsInput.Native.VirtualKeyCode.VK_C);
                await Task.Delay(20);

                item = ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            ClipboardHelper.ClearClipboard();
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClipboardLurker" /> class.
        /// </summary>
        public ClipboardLurker()
        {
            ClipboardHelper.ClearClipboard();
            this._clipboardMonitor = new SharpClipboard();

            this._clipboardMonitor.ClipboardChanged += this.ClipboardMonitor_ClipboardChanged;
        }
コード例 #3
0
        void OnSheetsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            IEnumerable enumerable  = (e.NewItems == null) ? ((IEnumerable) new Worksheet[0]) : ((IEnumerable)e.NewItems);
            IEnumerable enumerable2 = (e.OldItems == null) ? ((IEnumerable) new Worksheet[0]) : ((IEnumerable)e.OldItems);

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
            case NotifyCollectionChangedAction.Remove:
            case NotifyCollectionChangedAction.Replace:
            case NotifyCollectionChangedAction.Reset:
                foreach (Worksheet worksheet in enumerable2)
                {
                    DetachSheet(worksheet);
                }
                foreach (Worksheet worksheet2 in enumerable)
                {
                    AttachSheet(worksheet2);
                }
                if ((SpreadXClipboard.Worksheet != null) && ((Workbook.Sheets == null) || !Workbook.Sheets.Contains(SpreadXClipboard.Worksheet)))
                {
                    ClipboardHelper.ClearClipboard();
                }
                break;

            case NotifyCollectionChangedAction.Move:
                break;

            default:
                return;
            }
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClipboardLurker" /> class.
        /// </summary>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="keyboardHelper">The keyboard helper.</param>
        public ClipboardLurker(SettingsService settingsService, PoeKeyboardHelper keyboardHelper)
        {
            ClipboardHelper.ClearClipboard();
            this._keyboardHelper   = keyboardHelper;
            this._simulator        = new InputSimulator();
            this._clipboardMonitor = new SharpClipboard();
            this._settingsService  = settingsService;

            this._settingsService.OnSave            += this.SettingsService_OnSave;
            this._clipboardMonitor.ClipboardChanged += this.ClipboardMonitor_ClipboardChanged;
            this._itemParser.CheckPledgeStatus();
            this.LurkForAction();
        }
コード例 #5
0
ファイル: MouseLurker.cs プロジェクト: wertyphil/Poe-Lurker
        /// <summary>
        /// Handles the RightButtonUp event of the MouseHook control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseMessageEventArgs"/> instance containing the event data.</param>
        private async void MouseHook_RightButtonUp(object sender, MouseMessageEventArgs e)
        {
            if (e.Alt && this._settingsService.SearchEnabled)
            {
                await Task.Delay(100);

                var item = await this.ParseItem();

                if (item != null)
                {
                    this.ItemDetails?.Invoke(this, item);
                }

                ClipboardHelper.ClearClipboard();
            }
        }
コード例 #6
0
        /// <summary>
        /// Handles the MouseLeftButtonUp event of the MouseHookService control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private async void MouseHook_LeftButtonUp(object sender, MouseMessageEventArgs e)
        {
            if (e.Shift && this._settingsService.MapEnabled)
            {
                await Task.Delay(100);

                var item = await this.ParseItem();

                if (item != null)
                {
                    this.ItemIdentified?.Invoke(this, item);
                }

                ClipboardHelper.ClearClipboard();
            }
        }
コード例 #7
0
        /// <summary>
        /// Gets the item base type in clipboard.
        /// </summary>
        /// <returns>The item search value.</returns>
        private async Task <string> GetItemSearchValueInClipboard()
        {
            try
            {
                this._simulator.Keyboard.ModifiedKeyStroke(WindowsInput.Native.VirtualKeyCode.CONTROL, WindowsInput.Native.VirtualKeyCode.VK_C);
                await Task.Delay(50);

                var text = ClipboardHelper.GetClipboardText();
                ClipboardHelper.ClearClipboard();

                return(this._itemParser.GetSearchValue(text));
            }
            catch
            {
                return(null);
            }
        }
コード例 #8
0
        /// <summary>
        /// Gets the item base type in clipboard.
        /// </summary>
        /// <returns>The item search value.</returns>
        private async Task <string> GetItemSearchValueInClipboard()
        {
            try
            {
                await Simulate.Events().ClickChord(WindowsInput.Events.KeyCode.Control, WindowsInput.Events.KeyCode.C).Invoke();

                await Task.Delay(50);

                var text = ClipboardHelper.GetClipboardText();
                ClipboardHelper.ClearClipboard();

                return(this._itemParser.GetSearchValue(text));
            }
            catch
            {
                return(null);
            }
        }
コード例 #9
0
ファイル: MouseLurker.cs プロジェクト: mortan/Poe-Lurker
        /// <summary>
        /// Handles the MouseLeftButtonUp event of the MouseHookService control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private async void MouseHook_LeftButtonUp(object sender, MouseMessageEventArgs e)
        {
            this.MouseLeftButtonUp?.Invoke(this, e);

            if (e.Control || !e.Shift || (!this._settingsService.MapEnabled && !this._settingsService.SearchEnabled))
            {
                return;
            }

            await Task.Delay(100);

            var item = await this.ParseItem();

            if (item != null)
            {
                this.ItemIdentified?.Invoke(this, item);
            }

            ClipboardHelper.ClearClipboard();
        }
コード例 #10
0
ファイル: MouseLurker.cs プロジェクト: jorizztan/Poe-Lurker
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async Task ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                item = await ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            if (item.ItemClass == ItemClass.Unknown)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            ClipboardHelper.ClearClipboard();
        }
コード例 #11
0
ファイル: MouseLurker.cs プロジェクト: Z0ld3n/Poe-Lurker
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async Task ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                await Simulate.Events().ClickChord(WindowsInput.Events.KeyCode.LControlKey, WindowsInput.Events.KeyCode.C).Invoke();

                await Task.Delay(100);

                item = ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            ClipboardHelper.ClearClipboard();
        }