Beispiel #1
0
		public static void Create(HOOKS hook, string identifier) {
			int index = HookToIndex(hook);
			if (System.Diagnostics.Debugger.IsAttached){
				if (index < hooks.Length ? hooks[index] != null : false)
					throw new Exception(String.Format("Error: Hook index '{0}' already exists.", index));
				if (hookStrings.ContainsKey(identifier))
					throw new Exception(String.Format("Error: Hook indentifier '{0}' already exists.", identifier));
			}
			
			if (index >= hooks.Length)
				Array.Resize(ref hooks, index + 1); //As we're using primitive arrays, resize if the id is larger than the allocated size
			
			hooks[index] = new List<Item>(){};
			hookStrings.Add(identifier, index);
		}
Beispiel #2
0
		public static void Add(HOOKS hook, Action funct) {
			AddFunct(GetActionList(HookToIndex(hook)), new ItemNoPara(funct));
		}
Beispiel #3
0
		public static void Add(HOOKS hook, Action<System.Object[]> funct) {
			AddFunct(GetActionList(HookToIndex(hook)), new Item(funct));
		}
Beispiel #4
0
		private static int HookToIndex(HOOKS hook) {
			return (int) hook;
		}
Beispiel #5
0
		public static void Call(HOOKS hook, params System.Object[] para) {
			Item.para = para;
			Call(hook);
		}
Beispiel #6
0
		public static void Call(HOOKS hook) {
			GetActionList(HookToIndex(hook)).ForEach(Invoke);
		}