Beispiel #1
0
        public List <HookMethod> GetHookMethod(object[] args, int index, out HookCache cache)
        {
            if (args == null || index >= args.Length)
            {
                cache = this;
                return(_methods);
            }

            HookCache nextCache;

            if (args[index] == null)
            {
                if (!_cache.TryGetValue(NullKey, out nextCache))
                {
                    nextCache = new HookCache();
                    _cache.Add(NullKey, nextCache);
                }
            }
            else
            {
                if (!_cache.TryGetValue(args[index].GetType().FullName, out nextCache))
                {
                    nextCache = new HookCache();
                    _cache.Add(args[index].GetType().FullName, nextCache);
                }
            }
            //Interface.Oxide.ServerConsole.AddMessage($"GetHookMethod {key} {index}");
            return(nextCache.GetHookMethod(args, index + 1, out cache));
        }
Beispiel #2
0
 public List <HookMethod> GetHookMethod(string hookName, object[] args, out HookCache cache)
 {
     //Interface.Oxide.ServerConsole.AddMessage($"GetHookMethod {hookName}");
     if (!_cache.TryGetValue(hookName, out HookCache nextCache))
     {
         nextCache = new HookCache();
         _cache.Add(hookName, nextCache);
     }
     return(nextCache.GetHookMethod(args, 0, out cache));
 }
Beispiel #3
0
        public List <HookMethod> GetHookMethod(string hookName, object[] args, out HookCache cache)
        {
            HookCache hookCache;

            if (!this._cache.TryGetValue(hookName, out hookCache))
            {
                hookCache = new HookCache();
                this._cache.Add(hookName, hookCache);
            }
            return(hookCache.GetHookMethod(args, 0, out cache));
        }
Beispiel #4
0
        public List <HookMethod> GetHookMethod(object[] args, int index, out HookCache cache)
        {
            HookCache hookCache;

            if (args == null || index >= (int)args.Length)
            {
                cache = this;
                return(this._methods);
            }
            if (args[index] == null)
            {
                if (!this._cache.TryGetValue(this.NullKey, out hookCache))
                {
                    hookCache = new HookCache();
                    this._cache.Add(this.NullKey, hookCache);
                }
            }
            else if (!this._cache.TryGetValue(args[index].GetType().FullName, out hookCache))
            {
                hookCache = new HookCache();
                this._cache.Add(args[index].GetType().FullName, hookCache);
            }
            return(hookCache.GetHookMethod(args, index + 1, out cache));
        }