Пример #1
0
        public SettingsDialog(CompositeHook hook, ISettings settings)
        {
            InitializeComponent();
            Settings = settings;
            Hook     = hook;

            txtStartSplit.DataBindings.Add("Text", this, "SplitKey");
            txtReset.DataBindings.Add("Text", this, "ResetKey");
            txtSkip.DataBindings.Add("Text", this, "SkipKey");
            txtUndo.DataBindings.Add("Text", this, "UndoKey");
            txtPause.DataBindings.Add("Text", this, "PauseKey");
            txtToggle.DataBindings.Add("Text", this, "ToggleGlobalHotkeys");
            txtSwitchPrevious.DataBindings.Add("Text", this, "SwitchComparisonPrevious");
            txtSwitchNext.DataBindings.Add("Text", this, "SwitchComparisonNext");
            chkGlobalHotkeys.DataBindings.Add("Checked", this, "GlobalHotkeysEnabled");
            chkDeactivateForOtherPrograms.DataBindings.Add("Checked", this, "DeactivateHotkeysForOtherPrograms");
            chkWarnOnReset.DataBindings.Add("Checked", this, "WarnOnReset");
            chkDoubleTap.DataBindings.Add("Checked", this, "DoubleTapPrevention");
            txtDelay.DataBindings.Add("Text", this, "HotkeyDelay");
            cbxRaceViewer.DataBindings.Add("SelectedItem", this, "RaceViewer");
            chkSimpleSOB.CheckedChanged += chkSimpleSOB_CheckedChanged;

            /*trkRefreshRate.DataBindings.Add("Value", this, "RefreshRate", false, DataSourceUpdateMode.OnPropertyChanged);
             * trkRefreshRate.ValueChanged += trkRefreshRate_ValueChanged;
             * lblDisplayInterval.Text = ((int)(1000f / (60f - trkRefreshRate.Value) + 0.5f)).ToString() + " ms";*/
            SetClickEvents();

            chkGlobalHotkeys.CheckedChanged += chkGlobalHotkeys_CheckedChanged;
            this.Load += SettingsDialog_Load;
        }
Пример #2
0
        private void RegisterScrolling(CompositeHook hook)
        {
            var mouse = hook.GetMouse();
            var name  = mouse.Information.InstanceName + " " + mouse.Information.InstanceGuid;

            ScrollUp   = new KeyOrButton(new GamepadButton(name, "Scroll_Up"));
            ScrollDown = new KeyOrButton(new GamepadButton(name, "Scroll_Down"));
            hook.RegisterHotKey(ScrollUp);
            hook.RegisterHotKey(ScrollDown);
        }
Пример #3
0
 private void RegisterHotkey(CompositeHook hook, KeyOrButton key)
 {
     hook.RegisterHotKey(key);
     if (DeactivateHotkeysForOtherPrograms && key.IsKey && GlobalHotkeysEnabled)
     {
         var args      = new System.Windows.Forms.KeyEventArgs(key.Key);
         var modifiers = (args.Alt ? ModifierKeys.Alt : ModifierKeys.None)
                         | (args.Shift ? ModifierKeys.Shift : ModifierKeys.None)
                         | (args.Control ? ModifierKeys.Control : ModifierKeys.None);
         HotkeyHook.Instance.RegisterHotKey(modifiers, args.KeyCode);
     }
 }
Пример #4
0
 private void RegisterHotkey(CompositeHook hook, KeyOrButton key, bool deactivateForOtherPrograms)
 {
     //hook.RegisterHotKey(key);
     if (deactivateForOtherPrograms && key.IsKey)
     {
         var args      = new Eto.Forms.KeyEventArgs(key.Key, Eto.Forms.KeyEventType.KeyUp);
         var modifiers = (args.Alt ? Eto.Forms.Keys.Alt : Eto.Forms.Keys.None)
                         | (args.Shift ? Eto.Forms.Keys.Shift : Eto.Forms.Keys.None)
                         | (args.Control ? Eto.Forms.Keys.Control : Eto.Forms.Keys.None);
         //  HotkeyHook.Instance.RegisterHotKey(modifiers, args.KeyCode);
     }
 }
Пример #5
0
        public CounterComponentSettings()
        {
            InitializeComponent();

            Hook = new CompositeHook();

            // Set default values.
            GlobalHotkeysEnabled = false;
            CounterFont          = new Font("Segoe UI", 13, FontStyle.Regular, GraphicsUnit.Pixel);
            OverrideCounterFont  = false;
            CounterTextColor     = Color.FromArgb(255, 255, 255, 255);
            CounterValueColor    = Color.FromArgb(255, 255, 255, 255);
            OverrideTextColor    = false;
            BackgroundColor      = Color.Transparent;
            BackgroundColor2     = Color.Transparent;
            BackgroundGradient   = GradientType.Plain;
            CounterText          = "Counter:";
            InitialValue         = 0;
            Increment            = 1;

            // Hotkeys
            IncrementKey = new KeyOrButton(Keys.Add);
            DecrementKey = new KeyOrButton(Keys.Subtract);
            ResetKey     = new KeyOrButton(Keys.NumPad0);

            // Set bindings.
            txtIncrement.Text = FormatKey(IncrementKey);
            txtDecrement.Text = FormatKey(DecrementKey);
            txtReset.Text     = FormatKey(ResetKey);
            txtCounterText.DataBindings.Add("Text", this, "CounterText");
            numInitialValue.DataBindings.Add("Value", this, "InitialValue");
            numIncrement.DataBindings.Add("Value", this, "Increment");
            chkGlobalHotKeys.DataBindings.Add("Checked", this, "GlobalHotkeysEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
            chkFont.DataBindings.Add("Checked", this, "OverrideCounterFont", false, DataSourceUpdateMode.OnPropertyChanged);
            lblFont.DataBindings.Add("Text", this, "CounterFontString", false, DataSourceUpdateMode.OnPropertyChanged);
            chkColor.DataBindings.Add("Checked", this, "OverrideTextColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor.DataBindings.Add("BackColor", this, "CounterTextColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor3.DataBindings.Add("BackColor", this, "CounterValueColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor1.DataBindings.Add("BackColor", this, "BackgroundColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor2.DataBindings.Add("BackColor", this, "BackgroundColor2", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbGradientType.DataBindings.Add("SelectedItem", this, "GradientString", false, DataSourceUpdateMode.OnPropertyChanged);

            // Assign event handlers.
            cmbGradientType.SelectedIndexChanged += cmbGradientType_SelectedIndexChanged;
            chkFont.CheckedChanged          += chkFont_CheckedChanged;
            chkColor.CheckedChanged         += chkColor_CheckedChanged;
            chkGlobalHotKeys.CheckedChanged += chkGlobalHotKeys_CheckedChanged;

            Load += CounterSettings_Load;

            RegisterHotKeys();
        }
Пример #6
0
        public MemoryReaderComponentSettings()
        {
            InitializeComponent();

            Hook = new CompositeHook();

            // Set default values.
            MemReaderFont         = new Font("Segoe UI", 13, FontStyle.Regular, GraphicsUnit.Pixel);
            OverrideMemReaderFont = false;
            MemReaderTextColor    = Color.FromArgb(255, 255, 255, 255);
            MemReaderValueColor   = Color.FromArgb(255, 255, 255, 255);
            OverrideTextColor     = false;
            BackgroundColor       = Color.Transparent;
            BackgroundColor2      = Color.Transparent;
            BackgroundGradient    = GradientType.Plain;
            MemReaderText         = "Mem Value";
            MemReaderGameTitle    = "Process Name (no .exe)";
            MemReaderAddress      = "0x00112233";
            MemReaderType         = 1; // Default to reading 2 bytes
            MemReaderSigned       = false;
            MemReaderAddressList  = new List <Game>();

            // Set bindings.

            memReaderText.DataBindings.Add("Text", this, "MemReaderText");
            memReaderGameTitle.DataBindings.Add("Text", this, "memReaderGameTitle");
            memReaderAddress.DataBindings.Add("Text", this, "memReaderAddress");
            memReaderSigned.DataBindings.Add("Checked", this, "memReaderSigned");
            memReaderHide.DataBindings.Add("Checked", this, "memReaderHide");

            chkFont.DataBindings.Add("Checked", this, "OverrideMemReaderFont", false, DataSourceUpdateMode.OnPropertyChanged);
            lblFont.DataBindings.Add("Text", this, "MemReaderFontString", false, DataSourceUpdateMode.OnPropertyChanged);
            chkColor.DataBindings.Add("Checked", this, "OverrideTextColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor.DataBindings.Add("BackColor", this, "MemReaderTextColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor3.DataBindings.Add("BackColor", this, "MemReaderValueColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor1.DataBindings.Add("BackColor", this, "BackgroundColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnColor2.DataBindings.Add("BackColor", this, "BackgroundColor2", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbGradientType.DataBindings.Add("SelectedItem", this, "GradientString", false, DataSourceUpdateMode.OnPropertyChanged);

            // Assign event handlers.
            cmbGradientType.SelectedIndexChanged += cmbGradientType_SelectedIndexChanged;
            chkFont.CheckedChanged  += chkFont_CheckedChanged;
            chkColor.CheckedChanged += chkColor_CheckedChanged;

            Load += MemReaderSettings_Load;
        }
Пример #7
0
        public SettingsDialog(CompositeHook hook, ISettings settings, string hotkeyProfile)
        {
            InitializeComponent();
            Settings = settings;
            Hook     = hook;

            InitializeHotkeyProfiles(hotkeyProfile);
            SetClickEvents(this);

            chkGlobalHotkeys.DataBindings.Add("Checked", this, "GlobalHotkeysEnabled");
            chkDoubleTap.DataBindings.Add("Checked", this, "DoubleTapPrevention");
            txtDelay.DataBindings.Add("Text", this, "HotkeyDelay");
            chkWarnOnReset.DataBindings.Add("Checked", Settings, "WarnOnReset");
            cbxRaceViewer.DataBindings.Add("SelectedItem", this, "RaceViewer");

            UpdateDisplayedHotkeyValues();
            RefreshRemoveButton();
        }
Пример #8
0
        public SettingsDialog(CompositeHook hook, ISettings settings)
        {
            InitializeComponent();
            Settings = settings;
            Hook     = hook;

            txtStartSplit.DataBindings.Add("Text", this, "SplitKey");
            txtReset.DataBindings.Add("Text", this, "ResetKey");
            txtSkip.DataBindings.Add("Text", this, "SkipKey");
            txtUndo.DataBindings.Add("Text", this, "UndoKey");
            txtPause.DataBindings.Add("Text", this, "PauseKey");
            txtToggle.DataBindings.Add("Text", this, "ToggleGlobalHotkeys");
            txtSwitchPrevious.DataBindings.Add("Text", this, "SwitchComparisonPrevious");
            txtSwitchNext.DataBindings.Add("Text", this, "SwitchComparisonNext");
            chkGlobalHotkeys.DataBindings.Add("Checked", this, "GlobalHotkeysEnabled");
            chkWarnOnReset.DataBindings.Add("Checked", this, "WarnOnReset");
            chkDoubleTap.DataBindings.Add("Checked", this, "DoubleTapPrevention");
            txtDelay.DataBindings.Add("Text", this, "HotkeyDelay");
            cbxRaceViewer.DataBindings.Add("SelectedItem", this, "RaceViewer");

            SetClickEvents();
        }
Пример #9
0
 public void UnregisterAllHotkeys(CompositeHook hook)
 {
     hook.UnregisterAllHotkeys();
     HotkeyHook.Instance.UnregisterAllHotkeys();
 }
Пример #10
0
 public void RegisterHotkeys(CompositeHook hook)
 {
     try
     {
         UnregisterAllHotkeys(hook);
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
     try
     {
         RegisterScrolling(hook);
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
     if (SplitKey != null)
     {
         try
         {
             RegisterHotkey(hook, SplitKey);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (ResetKey != null)
     {
         try
         {
             RegisterHotkey(hook, ResetKey);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (SkipKey != null)
     {
         try
         {
             RegisterHotkey(hook, SkipKey);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (UndoKey != null)
     {
         try
         {
             RegisterHotkey(hook, UndoKey);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (PauseKey != null)
     {
         try
         {
             RegisterHotkey(hook, PauseKey);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (ToggleGlobalHotkeys != null)
     {
         try
         {
             RegisterHotkey(hook, ToggleGlobalHotkeys);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (SwitchComparisonPrevious != null)
     {
         try
         {
             RegisterHotkey(hook, SwitchComparisonPrevious);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
     if (SwitchComparisonNext != null)
     {
         try
         {
             RegisterHotkey(hook, SwitchComparisonNext);
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     }
 }
Пример #11
0
 public WheelOfTime()
 {
     _hideMissionObjectivesKeys = new List <KeyOrButton>();
     _hook = new CompositeHook();
     _hook.KeyOrButtonPressed += hook_KeyOrButtonPressed;
 }
Пример #12
0
        public void RegisterHotkeys(CompositeHook hook, string hotkeyProfileName)
        {
            try
            {
                UnregisterAllHotkeys(hook);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            if (HotkeyProfiles.ContainsKey(hotkeyProfileName))
            {
                var hotkeyProfile = HotkeyProfiles[hotkeyProfileName];
                var deactivateForOtherPrograms = hotkeyProfile.GlobalHotkeysEnabled && hotkeyProfile.DeactivateHotkeysForOtherPrograms;
                if (hotkeyProfile.SplitKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SplitKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.ResetKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.ResetKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.SkipKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SkipKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.UndoKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.UndoKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.PauseKey != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.PauseKey, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.ToggleGlobalHotkeys != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.ToggleGlobalHotkeys, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.SwitchComparisonPrevious != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SwitchComparisonPrevious, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
                if (hotkeyProfile.SwitchComparisonNext != null)
                {
                    try
                    {
                        RegisterHotkey(hook, hotkeyProfile.SwitchComparisonNext, deactivateForOtherPrograms);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e);
                    }
                }
            }
        }
Пример #13
0
 public void RegisterHotkeys(CompositeHook hook)
 {
     this.state.Settings.RegisterHotkeys(hook);
 }