Add GetString Function in ValueHelper
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Modbus.Net
|
||||
{
|
||||
@@ -386,6 +387,21 @@ namespace Modbus.Net
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将byte数组中相应的位置转换为字符串
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="encoding"></param>
|
||||
/// <returns></returns>
|
||||
public virtual string GetString(byte[] data, int count, ref int pos, Encoding encoding)
|
||||
{
|
||||
string t = encoding.GetString(data, pos, count);
|
||||
pos += count;
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将byte数组中相应的位置转换为8个bit数字
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user