• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Server.CrashedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Server.CrashedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# CrashedEventArgs类的具体用法?C# CrashedEventArgs怎么用?C# CrashedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CrashedEventArgs类属于Server命名空间,在下文中一共展示了CrashedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Restart

        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" );
            }
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:23,代码来源:CrashGuard.cs


示例17: GenerateCrashReport

 private static void GenerateCrashReport( CrashedEventArgs e )
 {
     GenerateCrashReport( e.Exception );
 }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:4,代码来源:CrashGuard.cs


示例18: CurrentDomain_UnhandledException

        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;
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:31,代码来源:Main.cs


示例19: InvokeCrashed

 public static void InvokeCrashed( CrashedEventArgs e )
 {
     if ( Crashed != null )
         Crashed( e );
 }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:5,代码来源:EventSink.cs


示例20: CurrentDomain_UnhandledException

        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();
            }
        }
开发者ID:felladrin,项目名称:runuo-pt-br,代码行数:43,代码来源:Main.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Server.GenericReader类代码示例发布时间:2022-05-26
下一篇:
C# Server.CommandEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap