Skip to content

Commit f87a6e9

Browse files
committed
refactor(HotfixModule): 将日志和异常消息从中文改为英文
统一使用英文作为日志和异常消息的语言,提高代码国际化程度 移除中文硬编码的提示信息,便于非中文开发者理解
1 parent 77819d3 commit f87a6e9

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

GameFrameX.Core/Hotfix/HotfixModule.cs

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
// ==========================================================================================
2-
// GameFrameX 组织及其衍生项目的版权、商标、专利及其他相关权利
3-
// GameFrameX organization and its derivative projects' copyrights, trademarks, patents, and related rights
4-
// 均受中华人民共和国及相关国际法律法规保护。
5-
// are protected by the laws of the People's Republic of China and relevant international regulations.
6-
//
7-
// 使用本项目须严格遵守相应法律法规及开源许可证之规定。
8-
// Usage of this project must strictly comply with applicable laws, regulations, and open-source licenses.
9-
//
10-
// 本项目采用 MIT 许可证与 Apache License 2.0 双许可证分发,
11-
// This project is dual-licensed under the MIT License and Apache License 2.0,
12-
// 完整许可证文本请参见源代码根目录下的 LICENSE 文件。
13-
// please refer to the LICENSE file in the root directory of the source code for the full license text.
14-
//
15-
// 禁止利用本项目实施任何危害国家安全、破坏社会秩序、
16-
// It is prohibited to use this project to engage in any activities that endanger national security, disrupt social order,
17-
// 侵犯他人合法权益等法律法规所禁止的行为!
18-
// or infringe upon the legitimate rights and interests of others, as prohibited by laws and regulations!
19-
// 因基于本项目二次开发所产生的一切法律纠纷与责任,
20-
// Any legal disputes and liabilities arising from secondary development based on this project
21-
// 本项目组织与贡献者概不承担。
22-
// shall be borne solely by the developer; the project organization and contributors assume no responsibility.
23-
//
24-
// GitHub 仓库:https://github.com/GameFrameX
25-
// GitHub Repository: https://github.com/GameFrameX
26-
// Gitee 仓库:https://gitee.com/GameFrameX
27-
// Gitee Repository: https://gitee.com/GameFrameX
28-
// 官方文档:https://gameframex.doc.alianblank.com/
29-
// Official Documentation: https://gameframex.doc.alianblank.com/
30-
// ==========================================================================================
31-
1+
// ==========================================================================================
2+
// GameFrameX 组织及其衍生项目的版权、商标、专利及其他相关权利
3+
// GameFrameX organization and its derivative projects' copyrights, trademarks, patents, and related rights
4+
// 均受中华人民共和国及相关国际法律法规保护。
5+
// are protected by the laws of the People's Republic of China and relevant international regulations.
6+
//
7+
// 使用本项目须严格遵守相应法律法规及开源许可证之规定。
8+
// Usage of this project must strictly comply with applicable laws, regulations, and open-source licenses.
9+
//
10+
// 本项目采用 MIT 许可证与 Apache License 2.0 双许可证分发,
11+
// This project is dual-licensed under the MIT License and Apache License 2.0,
12+
// 完整许可证文本请参见源代码根目录下的 LICENSE 文件。
13+
// please refer to the LICENSE file in the root directory of the source code for the full license text.
14+
//
15+
// 禁止利用本项目实施任何危害国家安全、破坏社会秩序、
16+
// It is prohibited to use this project to engage in any activities that endanger national security, disrupt social order,
17+
// 侵犯他人合法权益等法律法规所禁止的行为!
18+
// or infringe upon the legitimate rights and interests of others, as prohibited by laws and regulations!
19+
// 因基于本项目二次开发所产生的一切法律纠纷与责任,
20+
// Any legal disputes and liabilities arising from secondary development based on this project
21+
// 本项目组织与贡献者概不承担。
22+
// shall be borne solely by the developer; the project organization and contributors assume no responsibility.
23+
//
24+
// GitHub 仓库:https://github.com/GameFrameX
25+
// GitHub Repository: https://github.com/GameFrameX
26+
// Gitee 仓库:https://gitee.com/GameFrameX
27+
// Gitee Repository: https://gitee.com/GameFrameX
28+
// 官方文档:https://gameframex.doc.alianblank.com/
29+
// Official Documentation: https://gameframex.doc.alianblank.com/
30+
// ==========================================================================================
31+
3232
using System.Collections.Concurrent;
3333
using System.Reflection;
3434
using GameFrameX.Core.Abstractions.Agent;
@@ -156,12 +156,12 @@ internal bool Init(bool reload)
156156

157157
ParseDll();
158158

159-
LogHelper.Info($"热更DLL初始化成功: {_dllPath}");
159+
LogHelper.Info($"the hot change dll initialization succeeds: {_dllPath}");
160160
success = true;
161161
}
162162
catch (Exception e)
163163
{
164-
LogHelper.Error($"热更DLL初始化失败...\n{e}");
164+
LogHelper.Error($"the hot change dll initialization failed...\n{e}");
165165
if (!reload)
166166
{
167167
throw;
@@ -192,7 +192,7 @@ public void Unload()
192192
GC.WaitForPendingFinalizers();
193193
}
194194

195-
LogHelper.Warning($"热更DLL卸载{(weak.IsAlive ? "失败" : "成功")}");
195+
LogHelper.Warning($"hot dll uninstall{(weak.IsAlive ? "failure" : "successful")}");
196196
});
197197
}
198198
}
@@ -270,13 +270,13 @@ private bool AddHttpHandler(Type type)
270270
// 注册原始命令
271271
if (!_httpHandlerMap.TryAdd(attr.OriginalCmd, handler))
272272
{
273-
throw new Exception($"HTTP处理器命令重复注册,命令:{attr.OriginalCmd}");
273+
throw new Exception($"HTTP processor command repeatedly registers, command:{attr.OriginalCmd}");
274274
}
275275

276276
// 注册标准化的命名
277277
if (!_httpHandlerMap.TryAdd(attr.StandardCmd, handler))
278278
{
279-
throw new Exception($"HTTP处理器命令重复注册,命令:{attr.OriginalCmd}");
279+
throw new Exception($"HTTP processor command repeatedly registers, command:{attr.OriginalCmd}");
280280
}
281281

282282
return true;
@@ -298,7 +298,7 @@ private bool AddRpcHandler(Type type)
298298
var isHas = _rpcHandlerMap.TryGetValue(attribute.RequestMessage.GetType(), out var requestHandler);
299299
if (isHas && requestHandler?.GetType() == attribute.ResponseMessage.GetType())
300300
{
301-
LogHelper.Error($"重复注册消息RPC处理器:[{attribute.RequestMessage}] 消息:[{attribute.ResponseMessage}]");
301+
LogHelper.Error($"repeatedly register message rpc processors:[{attribute.RequestMessage}] message type:[{attribute.ResponseMessage}]");
302302
return false;
303303
}
304304

@@ -328,17 +328,17 @@ private bool AddTcpHandler(Type type)
328328

329329
if (!type.IsSealed)
330330
{
331-
throw new InvalidOperationException($"{classFullName} 必须是标记为sealed的类");
331+
throw new InvalidOperationException($"{classFullName} must be a class marked as sealed");
332332
}
333333

334334
if (!classFullName.EndsWith(GlobalConst.ComponentHandlerNameSuffix))
335335
{
336-
throw new Exception($"消息处理器 必须以[{GlobalConst.ComponentHandlerNameSuffix}]结尾{classFullName}");
336+
throw new Exception($"the message processor must be in the[{GlobalConst.ComponentHandlerNameSuffix}]ending{classFullName}");
337337
}
338338

339339
if (_tcpHandlerTypes.Contains(attribute.MessageType))
340340
{
341-
LogHelper.Error($"重复注册消息TCP处理器 类型:[{type.FullName}]");
341+
LogHelper.Error($"repeatedly register messages of the tcp processor type:[{type.FullName}]");
342342
return false;
343343
}
344344

@@ -351,7 +351,7 @@ private bool AddTcpHandler(Type type)
351351
var msgId = msgIdField.MessageId;
352352
if (!_tcpHandlerMap.TryAdd(msgId, type))
353353
{
354-
LogHelper.Error($"重复注册消息TCP处理器:[{msgId}] 消息:[{type}]");
354+
LogHelper.Error($"repeatedly register messages with tcp processors:[{msgId}] message type:[{type}]");
355355
}
356356

357357
_tcpHandlerTypes.Add(attribute.MessageType);
@@ -378,12 +378,12 @@ private bool AddEvent(Type type)
378378

379379
if (!type.IsSealed)
380380
{
381-
throw new InvalidOperationException($"{classFullName} 必须是标记为sealed的类");
381+
throw new InvalidOperationException($"{classFullName} must be a class marked as sealed");
382382
}
383383

384384
if (!classFullName.EndsWith(GlobalConst.EventListenerNameSuffix))
385385
{
386-
throw new Exception($"事件处理器 必须以[{GlobalConst.EventListenerNameSuffix}]结尾{classFullName}");
386+
throw new Exception($"the event handler must be based on [{GlobalConst.EventListenerNameSuffix}] ending{classFullName}");
387387
}
388388

389389
var compAgentType = type.BaseType.GetGenericArguments()[0];
@@ -395,13 +395,13 @@ private bool AddEvent(Type type)
395395
var infoAttributes = eventInfoAttributes.ToList();
396396
if (infoAttributes.Count == 0)
397397
{
398-
throw new Exception($"IEventListener:{type.FullName}没有指定监听的事件");
398+
throw new Exception($"IEventListener:{type.FullName} There are no events that are specified to listen to");
399399
}
400400

401401
var eventInfoAttribute = infoAttributes.FirstOrDefault();
402402
if (eventInfoAttribute == null)
403403
{
404-
throw new Exception($"IEventListener:{type.FullName}没有指定监听的事件");
404+
throw new Exception($"IEventListener:{type.FullName} There are no events that are specified to listen to");
405405
}
406406

407407
var evtId = eventInfoAttribute.EventId;
@@ -444,13 +444,13 @@ private bool AddAgent(Type type)
444444

445445
if (!fullName.EndsWith(GlobalConst.ComponentAgentNameSuffix))
446446
{
447-
throw new Exception($"组件代理必须以{GlobalConst.ComponentAgentNameSuffix}结尾{fullName}");
447+
throw new Exception($"the component agent must be based on [{GlobalConst.ComponentAgentNameSuffix}] ending{fullName}");
448448
}
449449

450450
var compType = type.BaseType.GetGenericArguments()[0];
451451
if (!_compAgentMap.TryAdd(compType, type))
452452
{
453-
throw new Exception($"组件:{compType.FullName}有多个代理");
453+
throw new Exception($"component:[{compType.FullName}] there are multiple agents");
454454
}
455455

456456
_agentCompMap[type] = compType;
@@ -475,7 +475,7 @@ internal BaseMessageHandler GetTcpHandler(int msgId)
475475
return handler;
476476
}
477477

478-
throw new Exception($"错误的TCP处理器类型,{instance.GetType().FullName}");
478+
throw new Exception($"wrong tcp processor type:{instance.GetType().FullName}");
479479

480480
//throw new HandlerNotFoundException($"消息ID:{msgId}");
481481
}

0 commit comments

Comments
 (0)