将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。

This commit is contained in:
QI Mingxuan
2026-04-16 17:31:13 +08:00
parent 6ec4c3ddaa
commit 2bd6e566c3
581 changed files with 74600 additions and 222 deletions
+21
View File
@@ -0,0 +1,21 @@
using HslCommunication;
using XP.Hardware.Plc.Exceptions;
namespace XP.Hardware.PLC.Helpers
{
/// <summary>
/// PLC 辅助类,提供数据类型转换和地址解析辅助方法 | PLC helper class, provides data type conversion and address parsing helper methods
/// </summary>
public static class PlcHelper
{
/// <summary>
/// 检查操作结果,抛出统一异常 | Check operation result and throw unified exception
/// </summary>
/// <param name="result">操作结果 | Operation result</param>
public static void CheckSuccess(OperateResult result)
{
if (!result.IsSuccess)
throw new PlcException($"PLC操作失败: {result.Message} (Code: {result.ErrorCode})");
}
}
}