示例#1
0
 private void InvokeHandlers(IEnumerable <IHIEventHandler> handlers, IHIEventArgs eventArgs)
 {
     foreach (IHIEventHandler handler in handlers)
     {
         SafeFire(handler, eventArgs);
     }
 }
示例#2
0
 private void SafeFire(IHIEventHandler handler, IHIEventArgs eventArgs)
 {
     try
     {
         handler.Invoke(eventArgs);
     }
     catch (Exception e)
     {
         string dumpPath = CoreManager.ServerCore.DumpException(e);
         CoreManager.ServerCore.ConsoleManager.Error("Event Handler", "An unhandled exception from an event handler has been swallowed!");
         CoreManager.ServerCore.ConsoleManager.Error("Event Handler", "    An exception dump has been saved to " + dumpPath);
     }
 }
示例#3
0
 private void Fire(string eventName, IHIEventArgs eventArgs, Plugin plugin)
 {
     InvokeHandlers(GetEventHandlers(eventName), eventArgs);
 }
示例#4
0
文件: ServerCore.cs 项目: habb0/IHI-1
        public void Shutdown(bool terminate = true)
        {
            lock (_bootInProgressLocker)
            {
                if (ConsoleManager == null)
                    return;

                ConsoleManager.Warning("Core", "Shutting down IHI!");

                if (CoreManager.ServerCore.OfficalEventFirer == null)
                    return;

                IHIEventArgs eventArgs = new IHIEventArgs();
                CoreManager.ServerCore.OfficalEventFirer.Fire("shutdown:before", eventArgs);
                CoreManager.ServerCore.OfficalEventFirer.Fire("shutdown:after", eventArgs);

                if (WebAdminManager == null)
                    return;

                WebAdminManager.Stop();

                Config = null;

                System.Console.Beep(4000, 100);
                System.Console.Beep(3500, 100);
                System.Console.Beep(3000, 100);
                System.Console.Beep(2500, 100);
                System.Console.Beep(2000, 100);
                System.Console.Beep(1500, 100);
                System.Console.Beep(1000, 100);
            }
        }