diff --git a/FunGame.Core/Library/Constant/ConstantSet.cs b/FunGame.Core/Library/Constant/ConstantSet.cs
index a29c289..57385ce 100644
--- a/FunGame.Core/Library/Constant/ConstantSet.cs
+++ b/FunGame.Core/Library/Constant/ConstantSet.cs
@@ -24,10 +24,10 @@ namespace Milimoe.FunGame.Core.Library.Constant
public class SocketSet
{
- public static int MaxRetryTimes { get; } = 20;
- public static int MaxConnection_1C2G { get; } = 10;
- public static int MaxConnection_General { get; } = 20;
- public static int MaxConnection_4C4G { get; } = 40;
+ public const int MaxRetryTimes = 20;
+ public const int MaxConnection_1C2G = 10;
+ public const int MaxConnection_General = 20;
+ public const int MaxConnection_4C4G = 40;
public const string Unknown = "Unknown";
public const string Connect = "Connect";
diff --git a/FunGame.Core/Library/Exception/ExceptionHelper.cs b/FunGame.Core/Library/Exception/ExceptionHelper.cs
index 7abb131..031b072 100644
--- a/FunGame.Core/Library/Exception/ExceptionHelper.cs
+++ b/FunGame.Core/Library/Exception/ExceptionHelper.cs
@@ -9,16 +9,9 @@ namespace Milimoe.FunGame.Core.Library.Exception
{
public static class ExceptionHelper
{
- public static string GetStackTrace(this System.Exception e)
+ public static string GetErrorInfo(this System.Exception e)
{
- if (e.Message != null && e.Message != "")
- {
- return $"ERROR: {e.Message}\n{e.StackTrace}";
- }
- else
- {
- return $"ERROR: \n{e.StackTrace}";
- }
+ return (e.InnerException != null) ? $"InnerExceoption: {e.InnerException}\n{e}" : e.ToString();
}
}
}
diff --git a/FunGame.Core/Library/Exception/SystemError.cs b/FunGame.Core/Library/Exception/SystemError.cs
index ec7e5a4..6371ede 100644
--- a/FunGame.Core/Library/Exception/SystemError.cs
+++ b/FunGame.Core/Library/Exception/SystemError.cs
@@ -26,9 +26,9 @@ namespace Milimoe.FunGame.Core.Library.Exception
e = new System.Exception(Name);
}
- public string GetStackTrace()
+ public string GetErrorInfo()
{
- return e.GetStackTrace();
+ return e.GetErrorInfo();
}
}
}
diff --git a/FunGame.Core/Service/ThreadManager.cs b/FunGame.Core/Service/ThreadManager.cs
index aafdfa6..b0d4180 100644
--- a/FunGame.Core/Service/ThreadManager.cs
+++ b/FunGame.Core/Service/ThreadManager.cs
@@ -12,7 +12,7 @@ namespace Milimoe.FunGame.Core.Service
///
/// 最大接受的线程数量
///
- private int MaxConnection { get; }
+ private int MaxTask { get; }
///
/// 可参与高并发的字典,但添加效率较低
@@ -22,14 +22,14 @@ namespace Milimoe.FunGame.Core.Service
///
/// Init ThreadManager
///
- /// MaxConnection
- internal ThreadManager(int MaxConnection = 0)
+ /// MaxTask
+ internal ThreadManager(int MaxTask = 0)
{
- if (MaxConnection <= 0)
- this.MaxConnection = Library.Constant.General.MaxTask_General;
+ if (MaxTask <= 0)
+ this.MaxTask = Library.Constant.General.MaxTask_General;
else
{
- this.MaxConnection = MaxConnection;
+ this.MaxTask = MaxTask;
}
}
@@ -54,7 +54,7 @@ namespace Milimoe.FunGame.Core.Service
/// True:操作成功
internal bool Add(string name, Task t)
{
- if (Threads.Count + 1 > MaxConnection) return false;
+ if (Threads.Count + 1 > MaxTask) return false;
return Threads.TryAdd(name, t);
}
diff --git a/FunGame.Desktop/Model/MainModel.cs b/FunGame.Desktop/Model/MainModel.cs
index c25764d..e90867e 100644
--- a/FunGame.Desktop/Model/MainModel.cs
+++ b/FunGame.Desktop/Model/MainModel.cs
@@ -38,7 +38,7 @@ namespace Milimoe.FunGame.Desktop.Model
}
catch (Exception e)
{
- Main?.GetMessage(e.GetStackTrace());
+ Main?.GetMessage(e.GetErrorInfo());
}
return false;
}
@@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Desktop.Model
}
catch (Exception e)
{
- Main?.GetMessage(e.GetStackTrace());
+ Main?.GetMessage(e.GetErrorInfo());
}
return false;
}
@@ -64,7 +64,7 @@ namespace Milimoe.FunGame.Desktop.Model
}
catch (Exception e)
{
- Main?.GetMessage(e.GetStackTrace());
+ Main?.GetMessage(e.GetErrorInfo());
}
}
@@ -92,7 +92,7 @@ namespace Milimoe.FunGame.Desktop.Model
}
catch (Exception e)
{
- Main?.GetMessage(e.GetStackTrace(), false);
+ Main?.GetMessage(e.GetErrorInfo(), false);
}
return false;
@@ -160,7 +160,7 @@ namespace Milimoe.FunGame.Desktop.Model
}
catch (Exception e)
{
- Main?.GetMessage(e.GetStackTrace(), false);
+ Main?.GetMessage(e.GetErrorInfo(), false);
}
return ConnectResult.ConnectFailed;
@@ -183,7 +183,7 @@ namespace Milimoe.FunGame.Desktop.Model
}
catch (Exception e)
{
- Main.GetMessage(e.GetStackTrace(), false);
+ Main.GetMessage(e.GetErrorInfo(), false);
return false;
}
return true;
@@ -259,7 +259,7 @@ namespace Milimoe.FunGame.Desktop.Model
catch (Exception e)
{
// 报错中断服务器连接
- Main?.GetMessage(e.GetStackTrace(), false);
+ Main?.GetMessage(e.GetErrorInfo(), false);
Main?.UpdateUI(MainControllerSet.Disconnected);
Close();
}
@@ -292,7 +292,7 @@ namespace Milimoe.FunGame.Desktop.Model
// 返回的objs是该Login的User对象的各个属性
if (objs.Length > 0) msg = (string)objs[0];
Main?.GetMessage(msg);
- Main?.UpdateUI(MainControllerSet.SetUser, true, TimeType.TimeOnly, new object[] { Factory.New(msg) });
+ Main?.UpdateUI(MainControllerSet.SetUser, new object[] { Factory.New(msg) });
}
private void SocketHandle_Disconnect(object[] objs)
diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs
index df2fb9f..f96ccc7 100644
--- a/FunGame.Desktop/UI/Main/Main.cs
+++ b/FunGame.Desktop/UI/Main/Main.cs
@@ -90,7 +90,7 @@ namespace Milimoe.FunGame.Desktop.UI
///
///
///
- public void UpdateUI(string? updatetype, bool time = true, TimeType timetype = TimeType.TimeOnly, object[]? objs = null)
+ public void UpdateUI(string? updatetype, object[]? objs = null)
{
void action()
{
@@ -164,16 +164,10 @@ namespace Milimoe.FunGame.Desktop.UI
Thread.Sleep(5000);
if (Others.Config.FunGame_isAutoRetry) MainController?.Do