public static void Log(Exception ex) { string str = DebugHud.Format_Exception_Log(ex, 1); DebugHud.Add_Line(str, true); }
public static _hook_result call(HOOK_ID hook, object sender, ref object returnValue, object[] args) { try { #if DEBUG SLog.Info("[SiscosHooks] {0}({1})", hook, Get_Arg_String(args)); #endif _hook_result result = new _hook_result(args); Dictionary <HookUID, Sisco_Hook_Delegate> cb_list; bool r = Events.TryGetValue((HOOK_ID)hook, out cb_list); if (r == false) { return(new _hook_result()); //no abort } List <HookUID> TRASH = null; foreach (KeyValuePair <HookUID, Sisco_Hook_Delegate> kvp in cb_list) { try { HookUID UID = kvp.Key; UID.hasFired = true; Sisco_Hook_Delegate act = kvp.Value; if (act == null) { continue; } Sisco_Return ret = act(ref sender, ref result.args, ref returnValue); // If this hook is a singleuse hook then we need to put it in our trashbin so we know to unregister it at the end of this function. if (UID.SingleUse) { if (TRASH == null) { TRASH = new List <HookUID>(); } TRASH.Add(UID); } if (ret != null) { if (ret.early_return) { result.abort = true; } if (ret.handled == true) { result.handled = true; break;//cancel all other events } } } catch (Exception ex) { Log(hook, ex.Message); Log(ex.StackTrace); } } if (TRASH != null) { foreach (HookUID uid in TRASH) { try { unregister(uid); } catch (Exception ex) { Log(uid.hook, DebugHud.Format_Exception_Log(ex)); } } } if (result == null) { Log(hook, "Result became NULL somehow!"); return(new _hook_result());// we MUST return something other then NULL or the whole game can screw up! } if (args != null && args.Length != result.args.Length) { Log(hook, "The size of Result.args does not match the number of arguments recieved from the function!"); } return(result); } catch (Exception ex) { Log(hook, ex.Message); Log(ex.StackTrace); return(new _hook_result()); } return(new _hook_result());//no abort }
public static void LogSilent(Exception ex) { string str = DebugHud.Format_Exception_Log(ex, 0); DebugHud.write_log(str); }