string解析

master
smartwyy 6 months ago
parent 3c0a52b2f9
commit eb04b0b759

@ -53,7 +53,7 @@ public static class BitUtls
if (propertyType == STRING) if (propertyType == STRING)
{ {
return Convert.ChangeType(Encoding.ASCII.GetString(bytes, start, length), propertyType); return Convert.ChangeType(Encoding.ASCII.GetString(bytes, start, length/8), propertyType);
} }
if (propertyType == BYTEARRAY) if (propertyType == BYTEARRAY)

@ -31,6 +31,13 @@ public static class ClientMgr
return o; return o;
} }
/// <summary>
/// 通过channel获取client
/// </summary>
/// <param name="channel"></param>
/// <param name="sn"></param>
/// <param name="client">获取不到client则为空</param>
/// <returns></returns>
public static bool TryGetClient(IChannel channel, out string sn, out ChargerClient? client) public static bool TryGetClient(IChannel channel, out string sn, out ChargerClient? client)
{ {
string? snt = ChannelUtils.GetAttr(channel, ChargerConst.ChargerSn); string? snt = ChannelUtils.GetAttr(channel, ChargerConst.ChargerSn);

Loading…
Cancel
Save