Exemple #1
0
        private void RemoveHookEventHandler(HookType type, Delegate value)
        {
            BaseHook key = GetHookObjectForType(type);

            Events.RemoveHandler(key, value);

            if (Events[key] == null)
            {
                key.Dispose();
            }

            hooks.Remove(key);
        }
Exemple #2
0
        private BaseHook GetHookObjectForType(HookType type)
        {
            BaseHook ret = null;

            foreach (BaseHook hook in hooks)
            {
                if (hook.Type == type)
                {
                    ret = hook;
                    break;
                }
            }

            return(ret);
        }
Exemple #3
0
        private void AddHookEventHandler(HookType type, Type classType, Delegate value)
        {
            BaseHook key = GetHookObjectForType(type);

            if (key == null)
            {
                key = (BaseHook)Activator.CreateInstance(classType, true);

                if (threadID != 0)
                {
                    key.SetHook(this, IntPtr.Zero, threadID);
                }

                hooks.Add(key);
            }

            Events.AddHandler(key, value);
        }