You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.6 KiB
C#
78 lines
1.6 KiB
C#
using HslCommunication;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace PLCCommunication.Common
|
|
{
|
|
public class PLCResult
|
|
{
|
|
//
|
|
// 摘要:
|
|
// 指示本次操作是否成功。
|
|
// Indicates whether this operation was successful.
|
|
public bool IsSuccess { get; set; }
|
|
|
|
//
|
|
// 摘要:
|
|
// 具体的错误描述。
|
|
// Specific error description.
|
|
public string Message { get; set; }
|
|
|
|
|
|
public int ErrorCode { get; set; }
|
|
|
|
//
|
|
// 摘要:
|
|
// 实例化一个默认的结果对象
|
|
public PLCResult()
|
|
{
|
|
}
|
|
|
|
//
|
|
// 摘要:
|
|
// 使用指定的消息实例化一个默认的结果对象
|
|
//
|
|
// 参数:
|
|
// msg:
|
|
// 错误消息
|
|
public PLCResult(string msg)
|
|
{
|
|
Message = msg;
|
|
}
|
|
|
|
//
|
|
// 摘要:
|
|
// 使用错误代码,消息文本来实例化对象
|
|
//
|
|
// 参数:
|
|
// err:
|
|
// 错误代码
|
|
//
|
|
// msg:
|
|
// 错误消息
|
|
public PLCResult(int err, string msg)
|
|
{
|
|
ErrorCode = err;
|
|
Message = msg;
|
|
}
|
|
}
|
|
|
|
public class PLCResult<T> : PLCResult
|
|
{
|
|
public T Content { get; set; }
|
|
|
|
public PLCResult()
|
|
{
|
|
|
|
}
|
|
|
|
public PLCResult(T content)
|
|
{
|
|
Content = content;
|
|
}
|
|
}
|
|
}
|