public void RestartScreenCapture() { if (Hooker != null && CaptureScreenShots) { Hooker.EnableRecorder(); } }
public void Dispose() { if (Hooker != null) { Hooker.Dispose(); } }
public async void Test(Hooker <MessageInformation> hook, CustomClientPage page) { if (page is null) { return; } await Task.Run(() => { page.Dispatcher.Invoke(() => { ProtocolJsonContent content = Content["infos"]["entityLook"]; Bitmap image = content.FromWeb(); SetModel(page.CharacterInformation, hook.Player, image); if (UIManager.Instance.UI.Container[hook.Proxy.ProcessId] is CustomButton btn) { btn.ButtonText = $"{hook.Player.Name}"; UIManager.Instance.UI.Container[hook.Proxy.ProcessId, true] = btn; } if (UIManager.Instance.UI.SelectedId == hook.Proxy.ProcessId) { UIManager.Instance.UI.Navigate(page, hook.Proxy.ProcessId); } }); }); }
private void Hooker_OnProcessStarted(Hooker <MessageInformation> obj) { CustomButton btn = new CustomButton() { BackgroundColor = new SolidColorBrush(Color.FromRgb(14, 154, 3)), SelectionColor = new SolidColorBrush(Color.FromRgb(213, 8, 8)), BackgroundEnterColor = new SolidColorBrush(Color.FromRgb(213, 8, 8)), ButtonText = $"Waiting ({obj.Proxy.ProcessId}) ..." }; btn.OnClick += _btn => { if (UI.SelectedId != obj.Proxy.ProcessId) { if (obj.Player is null) { UI.Navigate(MainWindow.Default, obj.Proxy.ProcessId); } else { UI.Navigate(ClientsPages[obj.Proxy.ProcessId], obj.Proxy.ProcessId); } } }; SetBtnUI(obj, btn); ClientsPages.Add(obj.Proxy.ProcessId, new CustomClientPage()); }
/// <summary> /// Base constructor of <see cref="BaseHookListener"/> /// </summary> /// <param name="hooker">Depending on this parameter the listener hooks either application or global keyboard events.</param> /// <remarks> /// Hooks are not active after instantiation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method. /// </remarks> protected BaseHookListener(Hooker hooker) { if (hooker == null) { throw new ArgumentNullException("hooker"); } m_Hooker = hooker; }
/// <summary> /// Enables you to switch from application hooks to global hooks and vice versa on the fly /// without unsubscribing from events. Component remains enabled or disabled state after this call as it was before. /// </summary> /// <param name="hooker">An AppHooker or GlobalHooker object.</param> public void Replace(Hooker hooker) { bool rememberEnabled = Enabled; Enabled = false; m_Hooker = hooker; Enabled = rememberEnabled; }
private async void UI_OnLaunchRequested(CustomButton btn) { Hooker <MessageInformation> hooker = HookManager <MessageInformation> .Instance.CreateHooker(); hooker.OnProcessStarted += Hooker_OnProcessStarted; hooker.OnProcessExited += Hooker_OnProcessExited; await btn.Dispatcher.BeginInvoke(new ExecuteActionUI(hooker.Inject)); }
/// <summary> /// Initializes a new instance of <see cref="MouseHookListener"/>. /// </summary> /// <param name="hooker">Depending on this parameter the listener hooks either application or global mouse events.</param> /// <remarks> /// Hooks are not active after installation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method. /// </remarks> public MouseHookListener(Hooker hooker) : base(hooker) { m_PreviousPosition = new Point(-1, -1); m_PreviousClickedTime = 0; m_DownButtonsWaitingForMouseUp = MouseButtons.None; m_SuppressButtonUpFlags = MouseButtons.None; m_PreviousClicked = MouseButtons.None; m_SystemDoubleClickTime = MouseNativeMethods.GetDoubleClickTime(); }
private void SetBtnUI(Hooker <MessageInformation> hooker, CustomButton btn) { UI.Container.Dispatcher.Invoke(() => { UI.Container[hooker.Proxy.ProcessId] = btn; if (btn is null && UI.SelectedId == hooker.Proxy.ProcessId) { UI.Navigate(MainWindow.Default, -1); } }); }
static void Main(string[] args) { var hook = new Hooker(); hook.MouseMove += Hook_MouseMove; hook.Hook(); while (!Console.KeyAvailable) { Thread.Sleep(100); } }
public VM() { _lex = new Lex(); _parser = new Parser(); _code_generator = new CodeGenerate(); _thread = new Thread(this); _other_threads = new Stack <Thread>(); m_global = NewTable(); m_import_manager = new ImportManager(); m_delegate_generate_mananger = new DelegateGenerateManager(); m_hooker = new Hooker(); }
public async override void Handle() { Hooker <MessageInformation> hook = HookManager <MessageInformation> .Instance[LocalClient.localIp.Port]; hook.Player = Content.FromBaseInformations(); CustomClientPage page = UIManager.Instance[hook.Proxy.ProcessId]; Test(hook, page); page?.Dispatcher.Invoke(() => { }); }
public void SetAttrsFromHCode(string HCode) { HCode = HCode.Trim(Program.WhiteSpaceChars); if (HCode == string.Empty) { throw new ArgumentException(); } HCode = Regex.Replace(HCode, "^/[Hh].[Nn]?", ""); //skip "A|B|W|S|Q|H" and "N" HCode = Regex.Replace(HCode, "#.*?(?=@)", ""); //skip "level" //skip "name or ordinal" string ModuleName_tmp = Regex.Match(HCode, "(?<=@.*?:).*$").Value; if (ModuleName_tmp == string.Empty) { ModuleName_tmp = VNName + ".exe"; } //hook addr IntPtr Addr_tmp = (IntPtr)Convert.ToUInt32(Regex.Match(HCode, "(?<=@).*?(?=(:|$))").Value, 16); //get hookers, HookerStrs[i] is like this: EspBias[*ValueAsAddrBias] string[] HookerStrs = Regex.Match(HCode, "^.*?(?=@)").Value.Split(':'); if (HookerStrs.Length < 1 || HookerStrs.Length > 2) { throw new ArgumentException(); } List <Hooker> Hookers_tmp = new List <Hooker>(); for (int i = 0; i < HookerStrs.Length; i++) { Hooker h = new Hooker(); h.EspBias = Cvt2EspBias(Regex.Match(HookerStrs[i], "^.*?(?=(\\*|$))").Value); h.ValueAsAddr = HookerStrs[i].IndexOf('*') != -1; if (h.ValueAsAddr) { h.ValueAsAddrBias = Cvt2ValueAsAddrBias(Regex.Match(HookerStrs[i], "(?<=\\*).*$").Value); } h.Addr = Addr_tmp; h.BytesPerRead = HookerStrs.Length == 1 ? 2 : 1; Hookers_tmp.Add(h); } ModuleName = ModuleName_tmp; Hookers = Hookers_tmp; }
/// <summary> /// All button presses are routed via comamnds here which do execute one of these commands /// </summary> /// <returns></returns> private Dictionary <string, ICommand> CreateUICommands() { Dictionary <string, ICommand> commands = new Dictionary <string, ICommand> { { "LogSlow", CreateCommand(_ => Hooker.LogSlowEvent()) }, { "LogFast", CreateCommand(_ => Hooker.LogFastEvent()) }, { "Config", CreateCommand(_ => ShowConfigDialog()) }, { "TraceRefresh", CreateCommand(_ => { TraceSessions = LocalTraceControler.GetTraceSessions(); WCFHost.GetTraceSessions.Execute(); }) }, { "StartTracing", CreateCommand(_ => StartTracing()) }, { "StopTracing", CreateCommand(_ => StopTracing()) }, { "CancelTracing", CreateCommand(_ => CancelTracing()) }, { "RegisterETWProvider", CreateCommand(_ => { string output = HookEvents.RegisterItself(); SetStatusMessage("Registering ETW provider: " + output); }) }, { "ConfigReset", CreateCommand(_ => { Configuration.Default.Reset(); Configuration.Default.Save(); LoadSettings(); }) }, { "ShowMessages", CreateCommand(_ => ShowMessages()) }, { "NetworkSendToggle", CreateCommand(_ => NetworkSendState.NetworkSendChangeState()) }, { "NetworkReceiveToggle", CreateCommand(_ => NetworkReceiveState.NetworkReceiveChangeState()) }, { "ClearStatusMessages", CreateCommand(_ => StatusMessages.Clear()) }, { "ShowCommandLineOptions", CreateCommand(_ => ShowCommandLineOptions()) }, { "About", CreateCommand(_ => AboutBox()) }, }; return(commands); }
public void SetHooker(Hooker func) { m_inputList.ForEach(rhs => rhs.InputHooker += func); }
/// <summary> /// Initializes a new instance of <see cref="KeyboardHookListener"/>. /// </summary> /// <param name="hooker">Depending on this parameter the listener hooks either application or global keyboard events.</param> /// <remarks>Hooks are not active after instantiation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method.</remarks> public KeyboardHookListener(Hooker hooker) : base(hooker) { }
///<summary> /// Creates an instance of the HotKeySetsListener, which attaches a Hot Key system to the Hooker selected. ///</summary> ///<param name="hksCollection">A collection of HotKeySets</param> ///<param name="hooker">Depending on this parameter the listener hooks either application or global keyboard events.</param> ///<remarks>Hooks are not active after instantiation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method.</remarks> public HotKeySetsListener(HotKeySetCollection hksCollection, Hooker hooker) : base(hooker) { m_hksCollection = hksCollection; }
protected override bool DoUI() { var directory = System.Reflection.Assembly.GetExecutingAssembly().Location; //string directory = System.AppDomain.CurrentDomain.BaseDirectory; //MessageBox.Show(directory); System.IO.Directory.SetCurrentDirectory(directory.Substring(0, directory.LastIndexOf("\\"))); Form = new EarthworkBlockingForm(this.m_app); PickObjectsMouseHook mouseHook = new PickObjectsMouseHook(); DialogResult result = DialogResult.Retry; while ((result = Form.ShowDialog(new Hook.RevitHandle(Process.GetCurrentProcess().MainWindowHandle))) == DialogResult.Retry) { if (result == DialogResult.Cancel) { return(false); } if (result == DialogResult.OK) { return(true); } if (Form.ShowDialogType == ShowDialogType.AddElements || Form.ShowDialogType == ShowDialogType.DeleleElements) { Hooker.DelegateCompletingAction(() => { Form.SelectedElementIds = m_uiDoc.Selection.PickObjects(ObjectType.Element, "选择要添加的构件") .Select(p => m_doc.GetElement(p.ElementId).Id).ToList(); }); Form.FinishElementSelection(); //Hooker Hooker = new Hooker(); //try //{ // Hooker.MouseHookProcedure = new Hooker.HookProc(MouseHookProc); // Hooker.Start(); // Form.SelectedElementIds = m_uiDoc.Selection.PickObjects(ObjectType.Element, "选择要添加的构件") // .Select(p => m_doc.GetElement(p.ElementId).Id).ToList(); // Hooker.Stop(); //} //catch (Exception ex) //{ // Hooker.Stop(); //} //try //{ // mouseHook.InstallHook(); // Form.SelectedElementIds = m_uiDoc.Selection.PickObjects(ObjectType.Element, "选择要添加的构件") // .Select(p => m_doc.GetElement(p.ElementId).Id).ToList(); // mouseHook.UninstallHook(); //} //catch //{ // mouseHook.UninstallHook(); //} } if (Form.ShowDialogType == ShowDialogType.ViewGT6 || Form.ShowDialogType == ShowDialogType.ViewCompletion) { Hooker.DelegateCompletingAction(() => { m_uiDoc.Selection.PickObjects(ObjectType.Element, ""); }); //try //{ // mouseHook.InstallHook(); // m_uiDoc.Selection.PickObjects(ObjectType.Element, ""); // mouseHook.UninstallHook(); //} //catch //{ // mouseHook.UninstallHook(); //} } } return(true); #region 非模态 //try //{ // if (ConfigPathManager.IniProjectDB(this.m_doc)) // { // Form = new EarthworkBlockingForm(this.m_app); // Form.ShowDialog(); // return true; // } // else // return false; //} //catch(Exception ex) //{ // TaskDialog.Show("错误", ex.Message); // return false; //} #endregion }
private static void HookNuterra(AssemblyDefinition assembly) { Hooker.Apply(assembly); }
private int CallNextHook(int nCode, int wParam, IntPtr lParam) { return(Hooker.CallNextHookEx(HookHandle, nCode, wParam, lParam)); }
public void ClearHooker(Hooker func) { m_inputList.ForEach(rhs => rhs.InputHooker = null); }
///<summary> /// Creates an instance of the HotKeySetsListener, which attaches a Hot Key system to the Hooker selected. ///</summary> ///<param name="hksCollection">A collection of HotKeySets</param> ///<param name="hooker">Depending on this parameter the listener hooks either application or global keyboard events.</param> ///<remarks>Hooks are not active after instantiation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method.</remarks> public HotKeySetsListener( HotKeySetCollection hksCollection, Hooker hooker ) : base(hooker) { m_hksCollection = hksCollection; }
private void Hooker_OnProcessExited(Hooker <MessageInformation> obj) { SetBtnUI(obj, null); }