Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ExceptionManager.cs
浏览该文件的文档.
1using Engine;
2using Engine.Input;
3
4namespace Game {
5 public static class ExceptionManager {
6 public static Exception m_error;
7
8 public static Exception Error => m_error;
9
10 public static void ReportExceptionToUser(string additionalMessage, Exception e) {
11 string arg = MakeFullErrorMessage(additionalMessage, e);
12 Log.Error($"{arg}\n{e.StackTrace}");
13 }
14
15 public static void DrawExceptionScreen() { }
16
17 public static void UpdateExceptionScreen() { }
18
19 public static string MakeFullErrorMessage(Exception e) => MakeFullErrorMessage(null, e);
20
21 public static string MakeFullErrorMessage(string additionalMessage, Exception e) {
22 string text = string.Empty;
23 if (!string.IsNullOrEmpty(additionalMessage)) {
24 text = additionalMessage;
25 }
26 for (Exception ex = e; ex != null; ex = ex.InnerException) {
27 text = text + (text.Length > 0 ? Environment.NewLine : string.Empty) + ex;
28 }
29 return text;
30 }
31
32 public static bool CheckContinueKey() {
33 if (Keyboard.IsKeyDown(Key.F12)
34 || Keyboard.IsKeyDown(Key.Back)) {
35 return true;
36 }
37 return false;
38 }
39 }
40}
static bool IsKeyDown(Key key)
static void Error(object message)
定义 Log.cs:80
static string MakeFullErrorMessage(Exception e)
static string MakeFullErrorMessage(string additionalMessage, Exception e)
static void ReportExceptionToUser(string additionalMessage, Exception e)