当前位置: 首页>>代码示例>>C#>>正文


C# Server.CrashedEventArgs类代码示例

本文整理汇总了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 );
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:8,代码来源:CrashGuard.cs

示例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)); }
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:8,代码来源:Broadcasts.cs

示例3: EventSink_Crashed

		public static void EventSink_Crashed( CrashedEventArgs e )
		{
			try
			{
				World.Broadcast( 0x35, true, "The server has crashed. Please Reconnect shortly." );
			}
			catch
			{
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:10,代码来源:Broadcasts.cs

示例4: EventSink_Crashed

		public static void EventSink_Crashed( CrashedEventArgs e )
		{
			try
			{
				World.Broadcast( 0x35, false, "Le serveur s'est brusquement coupé." );
			}
			catch
			{
			}
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:10,代码来源:Broadcasts.cs

示例5: EventSink_Crashed

 public static void EventSink_Crashed( CrashedEventArgs e )
 {
     try
     {
         World.Broadcast( 0x35, true, "Ocorreu um erro no servidor." );
     }
     catch
     {
     }
 }
开发者ID:felladrin,项目名称:runuo-pt-br,代码行数:10,代码来源:Broadcasts.cs

示例6: EventSink_Crashed

 public static void EventSink_Crashed( CrashedEventArgs e )
 {
     try
     {
         World.Broadcast(0x35, true, "[System]: The server has crashed.");
     }
     catch
     {
     }
 }
开发者ID:Godkong,项目名称:RunUO,代码行数:10,代码来源:Broadcasts.cs

示例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 );
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:13,代码来源:CrashGuard.cs

示例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 );
        }
开发者ID:AlcesAlces,项目名称:UOsmart,代码行数:15,代码来源:CrashGuard.cs

示例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 );
				}
			}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:17,代码来源:PokerGame.cs

示例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" );
			}
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:18,代码来源:CrashGuard.cs

示例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" );
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:77,代码来源:CrashGuard.cs

示例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;
			}
		}
开发者ID:Leodinas,项目名称:uolite,代码行数:47,代码来源:Main.cs

示例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();
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:9,代码来源:LogHelper.cs

示例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" );
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:77,代码来源:CrashGuard.cs

示例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));
					}
				}
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:18,代码来源:EventSink.cs


注:本文中的Server.CrashedEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。