public static void CrashGuard_OnCrash( CrashedEventArgs e ) { if ( SaveBackup ) Backup(); if ( GenerateReport ) GenerateCrashReport( e ); }
public static void EventSink_Crashed( CrashedEventArgs e ) { try { World.Broadcast( 0x35, true, "The server has crashed." ); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } }
public static void EventSink_Crashed( CrashedEventArgs e ) { try { World.Broadcast( 0x35, false, "Le serveur s'est brusquement coupé." ); } catch { } }
public static void EventSink_Crashed( CrashedEventArgs e ) { try { World.Broadcast( 0x35, true, "The server has crashed. Please Reconnect shortly." ); } catch { } }
public static void EventSink_Crashed( CrashedEventArgs e ) { try { World.Broadcast(0x35, true, "[System]: The server has crashed."); } catch { } }
public static void EventSink_Crashed( CrashedEventArgs e ) { try { World.Broadcast( 0x35, true, "Ocorreu um erro no servidor." ); } catch { } }
public static void CrashGuard_OnCrash( CrashedEventArgs e ) { if ( SaveBackup ) Backup(); if ( GenerateReport ) GenerateCrashReport( e ); if ( Core.Service ) e.Close = true; else if ( RestartServer ) Restart( e ); }
public static void CrashGuard_OnCrash( CrashedEventArgs e ) { if ( GenerateReport ) GenerateCrashReport( e ); World.WaitForWriteCompletion(); if ( SaveBackup ) Backup(); /*if ( Core.Service ) e.Close = true; else */ if ( RestartServer ) Restart( e ); }
private static void EventSink_Crashed( CrashedEventArgs e ) { foreach ( PokerGame game in GameBackup.PokerGames ) { List<PokerPlayer> toRemove = new List<PokerPlayer>(); foreach ( PokerPlayer player in game.Players.Players ) if ( player.Mobile != null ) toRemove.Add( player ); foreach ( PokerPlayer player in toRemove ) { player.SendMessage( 0x22, "The server has crashed, and you are now being removed from the poker game and being refunded the money that you currently have." ); game.RemovePlayer( player ); } } }
private static void Restart( CrashedEventArgs e ) { string root = GetRoot(); Console.Write( "Crash: Restarting..." ); try { Process.Start( Core.ExePath ); Console.WriteLine( "done" ); e.Close = true; } catch { Console.WriteLine( "failed" ); } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.IsTerminating ? "Error:" : "Warning:"); Console.WriteLine(e.ExceptionObject); if (e.IsTerminating) { _Crashed = true; bool close = false; try { CrashedEventArgs args = new CrashedEventArgs(e.ExceptionObject as Exception); EventSink.InvokeCrashed(args); close = args.Close; } catch { } if (!close && !Service) { try { foreach (Listener l in MessagePump.Listeners) { l.Dispose(); } } catch { } Console.WriteLine("This exception is fatal, press return to exit"); Console.ReadLine(); } Kill(); } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { log.Fatal(e.ExceptionObject); if (e.IsTerminating) { m_Crashed = true; try { CrashedEventArgs args = new CrashedEventArgs(e.ExceptionObject as Exception); EventSink.InvokeCrashed(args); } catch { } m_Closing = true; } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.IsTerminating ? "Error:" : "Warning:"); Console.WriteLine(e.ExceptionObject); if (!e.IsTerminating) { return; } m_Crashed = true; bool close = false; var args = new CrashedEventArgs(e.ExceptionObject as Exception); try { EventSink.InvokeCrashed(args); close = args.Close; } catch { } if (CrashedHandler != null) { try { CrashedHandler(args); close = args.Close; } catch { } } if (!close && !m_Service) { try { foreach (Listener t in m_MessagePump.Listeners) { try { t.Dispose(); } catch { } } } catch { } Console.WriteLine("This exception is fatal, press return to exit"); Console.ReadLine(); } Kill(); }
public static void InvokeCrashed( CrashedEventArgs e ) { if ( Crashed != null ) Crashed( e ); }
private static void GenerateCrashReport( CrashedEventArgs e ) { Console.Write( "Crash: Generating report..." ); try { string timeStamp = GetTimeStamp(); string fileName = String.Format( "Crash {0}.log", timeStamp ); string root = GetRoot(); string filePath = Combine( root, fileName ); using ( StreamWriter op = new StreamWriter( filePath ) ) { Version ver = Core.Assembly.GetName().Version; op.WriteLine( "Server Crash Report" ); op.WriteLine( "===================" ); op.WriteLine(); op.WriteLine( "RunUO Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision ); op.WriteLine( "Operating System: {0}", Environment.OSVersion ); op.WriteLine( ".NET Framework: {0}", Environment.Version ); op.WriteLine( "Time: {0}", DateTime.Now ); try { op.WriteLine( "Mobiles: {0}", World.Mobiles.Count ); } catch {} try { op.WriteLine( "Items: {0}", World.Items.Count ); } catch {} op.WriteLine( "Exception:" ); op.WriteLine( e.Exception ); op.WriteLine(); op.WriteLine( "Clients:" ); try { List<NetState> states = NetState.Instances; op.WriteLine( "- Count: {0}", states.Count ); for ( int i = 0; i < states.Count; ++i ) { NetState state = states[i]; op.Write( "+ {0}:", state ); Account a = state.Account as Account; if ( a != null ) op.Write( " (account = {0})", a.Username ); Mobile m = state.Mobile; if ( m != null ) op.Write( " (mobile = 0x{0:X} '{1}')", m.Serial.Value, m.Name ); op.WriteLine(); } } catch { op.WriteLine( "- Failed" ); } } Console.WriteLine( "done" ); if ( Email.CrashAddresses != null ) SendEmail( filePath ); } catch { Console.WriteLine( "failed" ); } }
private static void EventSink_Crashed(CrashedEventArgs e) { for (int ix = 0; ix < LogHelper.OpenLogs.Count; ix++) { LogHelper lh = LogHelper.OpenLogs[ix] as LogHelper; if (lh != null) lh.Finish(); } }
private static void CurrentDomain_UnhandledException( object sender, UnhandledExceptionEventArgs e ) { Console.WriteLine( e.IsTerminating ? "Error:" : "Warning:" ); Console.WriteLine( e.ExceptionObject ); if( e.IsTerminating ) { m_Crashed = true; bool close = false; try { CrashedEventArgs args = new CrashedEventArgs( e.ExceptionObject as Exception ); EventSink.InvokeCrashed( args ); close = args.Close; } catch { } if( !close && !m_Service ) { try { for( int i = 0; i < m_MessagePump.Listeners.Length; i++ ) { m_MessagePump.Listeners[i].Dispose(); } } catch { } if ( m_Service ) { Console.WriteLine( "This exception is fatal." ); } else { Console.WriteLine( "This exception is fatal, press return to exit" ); Console.ReadLine(); } } m_Closing = true; } }
private static void GenerateCrashReport( CrashedEventArgs e ) { Console.Write( "Crash: Generating report..." ); try { string timeStamp = GetTimeStamp(); string fileName = String.Format( "Crash {0}.log", timeStamp ); string root = GetRoot(); string filePath = Combine( root, fileName ); using ( StreamWriter op = new StreamWriter( filePath ) ) { op.WriteLine( "Server Crash Report" ); op.WriteLine( "===================" ); op.WriteLine(); op.WriteLine( "Operating System: {0}", Environment.OSVersion ); op.WriteLine( ".NET Framework: {0}", Environment.Version ); op.WriteLine( "Time: {0}", DateTime.Now ); try { op.WriteLine( "Mobiles: {0}", World.Mobiles.Count ); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } try { op.WriteLine( "Items: {0}", World.Items.Count ); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } op.WriteLine( "Clients:" ); try { //ArrayList states = NetState.Instances; List<NetState> states = NetState.Instances; op.WriteLine( "- Count: {0}", states.Count ); for ( int i = 0; i < states.Count; ++i ) { NetState state = states[i]; op.Write( "+ {0}:", state ); Account a = state.Account as Account; if ( a != null ) op.Write( " (account = {0})", a.Username ); Mobile m = state.Mobile; if ( m != null ) op.Write( " (mobile = 0x{0:X} '{1}')", m.Serial.Value, m.Name ); op.WriteLine(); } } catch { op.WriteLine( "- Failed" ); } op.WriteLine(); op.WriteLine( "Exception:" ); op.WriteLine( e.Exception ); } Console.WriteLine( "done" ); // don't send email from some random developer's computer if (Emails != null && Utility.IsHostPrivate(Utility.GetHost()) == false) SendEmail( filePath ); } catch { Console.WriteLine( "failed" ); } }
private static void CurrentDomain_UnhandledException( object sender, UnhandledExceptionEventArgs e ) { if (e.IsTerminating) log.Fatal(e); else log.Error(e); if ( e.IsTerminating ) { m_Crashed = true; try { CrashedEventArgs args = new CrashedEventArgs( e.ExceptionObject as Exception ); EventSink.InvokeCrashed( args ); } catch { } m_Closing = true; } }
public static void InvokeCrashed(CrashedEventArgs e) { OnCrashed?.Invoke(e); }
private static void CurrentDomain_UnhandledException( object sender, UnhandledExceptionEventArgs e ) { Console.WriteLine( e.IsTerminating ? "Erro:" : "Aviso:" ); Console.WriteLine( e.ExceptionObject ); if( e.IsTerminating ) { m_Crashed = true; bool close = false; try { CrashedEventArgs args = new CrashedEventArgs( e.ExceptionObject as Exception ); EventSink.InvokeCrashed( args ); close = args.Close; } catch { } if( !close && !m_Service ) { try { foreach (Listener l in m_MessagePump.Listeners) { l.Dispose(); } } catch { } Console.WriteLine( "Esta exceção é fatal, pressione ENTER para finalizar." ); Console.ReadLine(); } Kill(); } }
private static void CurrentDomain_UnhandledException( object sender, UnhandledExceptionEventArgs e ) { log.Fatal(e.ExceptionObject); if ( e.IsTerminating ) { m_Crashed = true; bool close = false; try { CrashedEventArgs args = new CrashedEventArgs( e.ExceptionObject as Exception ); EventSink.InvokeCrashed( args ); close = args.Close; } catch { } if ( !close && !m_Service ) { Console.WriteLine( "This exception is fatal, press return to exit" ); Console.ReadLine(); } m_Closing = true; } }
private static void GenerateCrashReport( CrashedEventArgs e ) { GenerateCrashReport( e.Exception ); }
public static void InvokeCrashed(CrashedEventArgs e) { if (Crashed != null) { foreach (CrashedEventHandler currentDelegate in Crashed.GetInvocationList()) { try { currentDelegate.Invoke(e); } catch (Exception ex) { // Log an exception EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.IsTerminating ? "Error:" : "Warning:"); Console.WriteLine(e.ExceptionObject); if (e.IsTerminating) { m_Crashed = true; bool close = false; CrashedEventArgs args = new CrashedEventArgs(e.ExceptionObject as Exception); if (CrashedHandler != null) { try { CrashedHandler(args); close = args.Close; } catch { } } try { EventSink.InvokeCrashed(args); close = args.Close; } catch { } if (!close && !m_Service) { try { for (int i = 0; i < m_MessagePump.Listeners.Length; i++) { m_MessagePump.Listeners[i].Dispose(); } } catch { } if (m_Service) { Console.WriteLine("This exception is fatal."); } else { Console.WriteLine("This exception is fatal, press return to exit"); Console.ReadLine(); } } Kill(); } }
private static void Restart( CrashedEventArgs e ) { string root = GetRoot(); Console.Write( "Crash: Restarting..." ); try { DateTime start = DateTime.Now; while ( ( AsyncWriter.ThreadCount > 0 /*|| Accounting.Accounts.ThreadRunning*/ ) && DateTime.Now - start < TimeSpan.FromMinutes( 5.0 ) ) System.Threading.Thread.Sleep( 100 ); System.Threading.Thread.Sleep( 1000 ); Process.Start( Core.ExePath ); Console.WriteLine( "done" ); e.Close = true; } catch { Console.WriteLine( "failed" ); } }