private static CurrentDomain_UnhandledException ( object sender, |
||
sender | object | |
e | ||
return | void |
public static void Main(string[] args) { int num1; string text1; int num2; TextWriter[] writerArray1; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Core.CurrentDomain_UnhandledException); AppDomain.CurrentDomain.ProcessExit += new EventHandler(Core.CurrentDomain_ProcessExit); bool flag1 = false; for (num1 = 0; (num1 < args.Length); ++num1) { if (Insensitive.Equals(args[num1], "-debug")) { flag1 = true; } else if (Insensitive.Equals(args[num1], "-service")) { Core.m_Service = true; } else if (Insensitive.Equals(args[num1], "-profile")) { Core.Profiling = true; } } try { if (Core.m_Service) { if (!Directory.Exists("Logs")) { Directory.CreateDirectory("Logs"); } writerArray1 = new TextWriter[2]; writerArray1[0] = Console.Out; writerArray1[1] = new FileLogger("Logs/Console.log"); Console.SetOut((Core.m_MultiConOut = new MultiTextWriter(writerArray1))); } else { writerArray1 = new TextWriter[1]; writerArray1[0] = Console.Out; Console.SetOut((Core.m_MultiConOut = new MultiTextWriter(writerArray1))); } } catch { } Core.m_Thread = Thread.CurrentThread; Core.m_Process = Process.GetCurrentProcess(); Core.m_Assembly = Assembly.GetEntryAssembly(); if (Core.m_Thread != null) { Core.m_Thread.Name = "Core Thread"; } if (Core.BaseDirectory.Length > 0) { Directory.SetCurrentDirectory(Core.BaseDirectory); } Server.Timer.TimerThread thread1 = new Server.Timer.TimerThread(); Core.timerThread = new Thread(new ThreadStart(thread1.TimerMain)); Core.timerThread.Name = "Timer Thread"; while (!ScriptCompiler.Compile(flag1)) { Console.WriteLine("Scripts: One or more scripts failed to compile or no script files were found."); Console.WriteLine(" - Press return to exit, or R to try again."); text1 = Console.ReadLine(); if ((text1 == null) || (text1.ToLower() != "r")) { return; } } Region.Load(); Core.m_MessagePump = new MessagePump(new Listener(Listener.Port)); Core.timerThread.Start(); for (num2 = 0; (num2 < Map.AllMaps.Count); ++num2) { ((Map)Map.AllMaps[num2]).Tiles.Force(); } NetState.Initialize(); EventSink.InvokeServerStarted(); try { while (!Core.m_Closing) { Thread.Sleep(1); Mobile.ProcessDeltaQueue(); Item.ProcessDeltaQueue(); Server.Timer.Slice(); Core.m_MessagePump.Slice(); NetState.ProcessDisposedQueue(); if (Core.Slice != null) { Core.Slice.Invoke(); } } } catch (Exception exception1) { Core.CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(exception1, true)); } if (Core.timerThread.IsAlive) { Core.timerThread.Abort(); } }