本文整理匯總了C#中Server.CrashedEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# CrashedEventArgs類的具體用法?C# CrashedEventArgs怎麽用?C# CrashedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CrashedEventArgs類屬於Server命名空間,在下文中一共展示了CrashedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CrashGuard_OnCrash
public static void CrashGuard_OnCrash( CrashedEventArgs e )
{
if ( SaveBackup )
Backup();
if ( GenerateReport )
GenerateCrashReport( e );
}
示例2: EventSink_Crashed
public static void EventSink_Crashed( CrashedEventArgs e )
{
try
{
World.Broadcast( 0x35, true, "The server has crashed." );
}
catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
}
示例3: EventSink_Crashed
public static void EventSink_Crashed( CrashedEventArgs e )
{
try
{
World.Broadcast( 0x35, true, "The server has crashed. Please Reconnect shortly." );
}
catch
{
}
}
示例4: EventSink_Crashed
public static void EventSink_Crashed( CrashedEventArgs e )
{
try
{
World.Broadcast( 0x35, false, "Le serveur s'est brusquement coupé." );
}
catch
{
}
}
示例5: EventSink_Crashed
public static void EventSink_Crashed( CrashedEventArgs e )
{
try
{
World.Broadcast( 0x35, true, "Ocorreu um erro no servidor." );
}
catch
{
}
}
示例6: EventSink_Crashed
public static void EventSink_Crashed( CrashedEventArgs e )
{
try
{
World.Broadcast(0x35, true, "[System]: The server has crashed.");
}
catch
{
}
}
示例7: CrashGuard_OnCrash
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 );
}
示例8: CrashGuard_OnCrash
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 );
}
示例9: EventSink_Crashed
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 );
}
}
}
示例10: Restart
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" );
}
}
示例11: GenerateCrashReport
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" );
}
}
示例12: CurrentDomain_UnhandledException
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;
}
}
示例13: EventSink_Crashed
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();
}
}
示例14: GenerateCrashReport
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" );
}
}
示例15: InvokeCrashed
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));
}
}
}
}