示例#1
0
        /// <summary>Initializes this plugin.</summary>
        public void Initialize()
        {
            // Make life easier!

            Hotkeys.Register("DevTab.RunCode", System.Windows.Forms.Keys.Q,
                             ModifierKeys.Alt | ModifierKeys.Shift,
                             h =>
            {
                if (!PluginManager.IsEnabled(this))
                {
                    return;
                }

                if (_instance != null)
                {
                    _instance.Dispatcher.BeginInvoke(new Action(() => _instance.ButtonExecuteText_Click(null, null)));
                }
            });

            Hotkeys.Register("DevTab.RunFile", System.Windows.Forms.Keys.Z,
                             ModifierKeys.Alt | ModifierKeys.Shift,
                             h =>
            {
                if (!PluginManager.IsEnabled(this))
                {
                    return;
                }

                if (_instance != null)
                {
                    _instance.Dispatcher.BeginInvoke(new Action(() => _instance.ButtonExecuteFile_Click(null, null)));
                }
            });
        }
示例#2
0
 static Input()
 {
     DebugMouseCursorPos = false;
     Hotkeys.Register("TritonHs.Input.DebugMouseCursorPos", Keys.X, ModifierKeys.Shift | ModifierKeys.Alt, new Action <Hotkey>(Class237.< > 9.method_0));
     Hotkeys.Register("TritonHs.ProcessHookManager.Disable", Keys.D, ModifierKeys.Shift | ModifierKeys.Alt, new Action <Hotkey>(Class237.< > 9.method_1));
     Hotkeys.Register("TritonHs.ProcessHookManager.Enable", Keys.E, ModifierKeys.Shift | ModifierKeys.Alt, new Action <Hotkey>(Class237.< > 9.method_2));
     Hotkeys.Register("TritonHs.ProcessHookManager.Reset", Keys.R, ModifierKeys.Shift | ModifierKeys.Alt, new Action <Hotkey>(Class237.< > 9.method_3));
 }
示例#3
0
        /// <summary>Initializes this plugin.</summary>
        public void Initialize()
        {
            Hotkeys.Register("PythonExample.RunCode", System.Windows.Forms.Keys.F,
                             ModifierKeys.Alt | ModifierKeys.Shift,
                             h =>
            {
                if (!PluginManager.IsEnabled(this))
                {
                    return;
                }

                if (_instance != null)
                {
                    _instance.Dispatcher.BeginInvoke(new Action(() => _instance.ExecutePythonButton_Click(null, null)));
                }
            });
        }
示例#4
0
        private void RegisterHotkeys()
        {
            // General
            Hotkeys.Register(Key.Escape, () =>
            {
                escapeWindow.Visible = !escapeWindow.Visible;
                // bring to front
                escapeWindow.Remove();
                RootWidget.AddChild(escapeWindow);
            });

            // HUD Menu
            Hotkeys.Register(Key.Tab, () => HudMenu.Activate(HudMenu.Button.Inventory));
            Hotkeys.Register(Key.E, KeyModifiers.Control, () => HudMenu.Activate(HudMenu.Button.Equipment));
            Hotkeys.Register(Key.T, KeyModifiers.Control, () => HudMenu.Activate(HudMenu.Button.Character));
            Hotkeys.Register(Key.B, KeyModifiers.Control, () => HudMenu.Activate(HudMenu.Button.BuddyList));
        }
        /// <summary>
        /// Registers all hotkeys.
        /// </summary>
        private void RegisterAllKeys()
        {
            foreach (var CurrentEntry in this.GetKeysWithID())
            {
                bool Registered = Hotkeys.Register(
                    HandlerWindow:  this.HandlerWindow,
                    ID:             CurrentEntry.Key,
                    Key:            CurrentEntry.Value
                    );

                if (Registered)
                {
                    this.UndoStack.Push(CurrentEntry);
                }
                else
                {
                    this.Registered = false;
                    Trace.TraceWarning($"[Hotkey] Failed to register the hotkey: RegistrationID={CurrentEntry.Key}, Key={CurrentEntry.Value}");
                }
            }
        }
示例#6
0
 public void method_21(object object_0)
 {
     try
     {
         this.method_22();
         string text;
         if (this.process_0 == null)
         {
             MessageBox.Show("can not find process");
             return;
         }
         else if (!TritonHs.smethod_0(this.process_0, Class12.smethod_4, out text))
         {
             Console.WriteLine(text);
             MessageBox.Show("TritonHs.smethod_0 == false");
         }
         else
         {
             TritonHs.Memory.ProcessExited += Class25.Instance.method_1;
             TritonHs.Memory.Executor.FrameDropWaitTime = 15000u;
             TritonHs.Memory.Executor.ExecuteWaitTime   = 15000;
             TritonHs.Memory.DisableCache();
             TritonHs.Memory.ClearCache();
             int version;
             int clientChangelist;
             using (TritonHs.AcquireFrame())
             {
                 version          = Version.version;
                 clientChangelist = Version.clientChangelist;
             }
             if ((long)version != (long)((ulong)Class247.UInt32_1) && (long)clientChangelist != (long)((ulong)Class247.UInt32_2))
             {
                 Console.WriteLine("Hearthstone client version ({0}, {1})", version, clientChangelist);
                 //MainWindow.ilog_0.InfoFormat("Hearthstone client version ({0}, {1})", version, clientChangelist);
                 //new Coroutine(new Func<Task>(Class25.Instance.method_2));
                 smethod_0();
                 //Configuration.Instance.AddSettings(MainSettings.Instance);
                 //Configuration.Instance.AddSettings(DevSettings.Instance);
                 //Configuration.Instance.SaveAll();
                 //base.Dispatcher.Invoke(new Action(this.method_23));
                 //BotManager.PreStart += this.method_11;
                 //BotManager.PostStop += this.method_10;
                 BotManager.Load();
                 this.method_24();
                 this.method_25();
                 //BotManager.OnBotChanged += this.method_6;
                 RoutineManager.Load();
                 this.method_26();
                 this.method_27();
                 //RoutineManager.OnRoutineChanged += this.method_7;
                 //PluginManager.Load();
                 //foreach (IPlugin plugin in PluginManager.Plugins)
                 //{
                 //    if (MainSettings.Instance.EnabledPlugins.Contains(plugin.Name))
                 //    {
                 //        using (TritonHs.AcquireFrame())
                 //        {
                 //            PluginManager.Enable(plugin);
                 //        }
                 //        Thread.Sleep(20);
                 //    }
                 //    else
                 //    {
                 //        using (TritonHs.AcquireFrame())
                 //        {
                 //            PluginManager.Disable(plugin);
                 //        }
                 //        Thread.Sleep(20);
                 //    }
                 //}
                 //this.listBox_0.Dispatcher.Invoke<IEnumerable>(new Func<IEnumerable>(this.method_28), DispatcherPriority.Normal);
                 this.method_29();
                 //PluginManager.PluginEnabled += this.method_5;
                 //PluginManager.PluginDisabled += this.method_4;
                 //MainWindow.ilog_0.ErrorFormat("{0}Please read the following guide before using this program:{0}https://github.com/ChuckHearthBuddy/SilverFish/blob/master/ReadMe.md", Environment.NewLine);
                 //base.Dispatcher.Invoke(new Action(this.method_30));
                 //base.Dispatcher.Invoke(new Action(this.method_31));
                 //this.stopwatch_0.Restart();
                 //RoutineManager.OnRoutineChanged += this.method_7;
                 //BotManager.OnBotChanged += this.method_6;
                 TritonHs.IsBotFullyLoaded = true;
                 Hotkeys.Register("BotManager.StartStop", Keys.S, ModifierKeys.Alt | ModifierKeys.Shift, Class25.Instance.method_3);
                 //if (CommandLine.Arguments.Exists("autostart"))
                 {
                     //var bot = new DefaultBot();
                     //BotManager.CurrentBot = bot;
                     BotManager.Start();
                 }
             }
             else
             {
                 text = string.Format("This client version ({0}, {1}) is unsupported. Hearthbuddy currently supports client version ({2}, {3}). Please check the forums for more information: https://www.thebuddyforum.com/hearthbuddy-forum/", new object[]
                 {
                     version,
                     clientChangelist,
                     Class247.UInt32_1,
                     Class247.UInt32_2
                 });
                 //MainWindow.ilog_0.ErrorFormat(text, Array.Empty<object>());
                 //System.Windows.MessageBox.Show(text, "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
                 //base.Dispatcher.BeginInvoke(new Action(base.Close), Array.Empty<object>());
             }
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         //MainWindow.ilog_0.Error("[OnStartup] A top-level exception has been caught.", exception);
     }
 }