mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
Feature UnhandledException handled
This commit is contained in:
@@ -155,6 +155,8 @@ public class ServerInfoTextCHS
|
||||
public string UnloadedItems => "卸载了所有 {0}。";
|
||||
public string SaveDatabase => "已保存数据库,用时 {0}s";
|
||||
public string WaitForAllDone => "现在还不可以进入游戏,请等待所有项目加载完成后再试";
|
||||
|
||||
public string UnhandledException => "发生未经处理的异常:{0}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -153,6 +153,8 @@ public class ServerInfoTextCHT
|
||||
public string UnloadedItems => "卸載了所有 {0}。";
|
||||
public string SaveDatabase => "已保存數據庫,用時 {0}s";
|
||||
public string WaitForAllDone => "現在還不可以進入遊戲,請等待所有項目加載完成後再試";
|
||||
|
||||
public string UnhandledException => "未處理的異常:{0}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -158,6 +158,8 @@ public class ServerInfoTextEN
|
||||
public string SaveDatabase => "Database saved in {0}s";
|
||||
|
||||
public string WaitForAllDone => "You cannot enter the game yet. Please wait for all items to load before trying again";
|
||||
|
||||
public string UnhandledException => "An unhandled exception occurred: {0}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -32,6 +32,14 @@ public class EntryPoint
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.Shutdown"));
|
||||
PerformCleanup();
|
||||
};
|
||||
AppDomain.CurrentDomain.UnhandledException += (obj, arg) =>
|
||||
{
|
||||
Logger.Error(I18NManager.Translate("Server.ServerInfo.UnhandledException", obj.GetType().Name), (Exception)arg.ExceptionObject);
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.Shutdown"));
|
||||
PerformCleanup();
|
||||
Environment.Exit(1);
|
||||
};
|
||||
|
||||
Console.CancelKeyPress += (_, eventArgs) =>
|
||||
{
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.CancelKeyPressed"));
|
||||
|
||||
Reference in New Issue
Block a user