mirror of
				https://gitee.com/ThingsGateway/ThingsGateway.git
				synced 2025-11-04 17:43:58 +08:00 
			
		
		
		
	修正部分代码格式
This commit is contained in:
		@@ -46,19 +46,6 @@ public static class StringExtensions
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 将16进制的字符转换为int32。
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="hexString"></param>
 | 
			
		||||
    /// <returns></returns>
 | 
			
		||||
    public static int ByHexStringToInt32(this string hexString)
 | 
			
		||||
    {
 | 
			
		||||
        if (string.IsNullOrEmpty(hexString))
 | 
			
		||||
        {
 | 
			
		||||
            return default;
 | 
			
		||||
        }
 | 
			
		||||
        return int.Parse(hexString, System.Globalization.NumberStyles.HexNumber);
 | 
			
		||||
    }
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// <inheritdoc cref="Path.Combine(string[])"/>
 | 
			
		||||
    /// 并把\\转为/
 | 
			
		||||
 
 | 
			
		||||
@@ -1289,13 +1289,6 @@
 | 
			
		||||
            <param name="value"></param>
 | 
			
		||||
            <returns></returns>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:ThingsGateway.Foundation.Extension.String.StringExtensions.ByHexStringToInt32(System.String)">
 | 
			
		||||
            <summary>
 | 
			
		||||
            将16进制的字符转换为int32。
 | 
			
		||||
            </summary>
 | 
			
		||||
            <param name="hexString"></param>
 | 
			
		||||
            <returns></returns>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:ThingsGateway.Foundation.Extension.String.StringExtensions.CombinePathOS(System.String,System.String[])">
 | 
			
		||||
            <summary>
 | 
			
		||||
            <inheritdoc cref="M:System.IO.Path.Combine(System.String[])"/>
 | 
			
		||||
 
 | 
			
		||||
@@ -31,11 +31,11 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    private DataFormat dataFormat;
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    [JsonIgnore]
 | 
			
		||||
    public Encoding Encoding { get; set; } = Encoding.UTF8;
 | 
			
		||||
    public virtual Encoding Encoding { get; set; } = Encoding.UTF8;
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public BcdFormat? BcdFormat { get; set; }
 | 
			
		||||
    public virtual BcdFormat? BcdFormat { get; set; }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public int StringLength { get; set; }
 | 
			
		||||
    public virtual int StringLength { get; set; }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 构造函数
 | 
			
		||||
@@ -55,7 +55,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public DataFormat DataFormat
 | 
			
		||||
    public virtual DataFormat DataFormat
 | 
			
		||||
    {
 | 
			
		||||
        get
 | 
			
		||||
        {
 | 
			
		||||
@@ -69,9 +69,9 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public EndianType EndianType => endianType;
 | 
			
		||||
    public virtual EndianType EndianType => endianType;
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public bool IsStringReverseByteWord { get; set; }
 | 
			
		||||
    public virtual bool IsStringReverseByteWord { get; set; }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public virtual IThingsGatewayBitConverter CreateByDateFormat(DataFormat dataFormat)
 | 
			
		||||
@@ -86,7 +86,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return byteConverter;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(bool value)
 | 
			
		||||
    public virtual byte[] GetBytes(bool value)
 | 
			
		||||
    {
 | 
			
		||||
        return GetBytes(new bool[1]
 | 
			
		||||
        {
 | 
			
		||||
@@ -95,13 +95,13 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(bool[] values)
 | 
			
		||||
    public virtual byte[] GetBytes(bool[] values)
 | 
			
		||||
    {
 | 
			
		||||
        return values?.BoolArrayToByte();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(short value)
 | 
			
		||||
    public virtual byte[] GetBytes(short value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = BitConverter.GetBytes(value);
 | 
			
		||||
        if (!IsSameOfSet())
 | 
			
		||||
@@ -111,7 +111,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return bytes;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(short[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(short[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -123,7 +123,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(ushort value)
 | 
			
		||||
    public virtual byte[] GetBytes(ushort value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = BitConverter.GetBytes(value);
 | 
			
		||||
        if (!IsSameOfSet())
 | 
			
		||||
@@ -133,7 +133,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return bytes;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(ushort[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(ushort[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -144,12 +144,12 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(int value)
 | 
			
		||||
    public virtual byte[] GetBytes(int value)
 | 
			
		||||
    {
 | 
			
		||||
        return ByteTransDataFormat4(BitConverter.GetBytes(value));
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(int[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(int[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -160,12 +160,12 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(uint value)
 | 
			
		||||
    public virtual byte[] GetBytes(uint value)
 | 
			
		||||
    {
 | 
			
		||||
        return ByteTransDataFormat4(BitConverter.GetBytes(value));
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(uint[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(uint[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -176,12 +176,12 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(long value)
 | 
			
		||||
    public virtual byte[] GetBytes(long value)
 | 
			
		||||
    {
 | 
			
		||||
        return ByteTransDataFormat8(BitConverter.GetBytes(value));
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(long[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(long[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -192,12 +192,12 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(ulong value)
 | 
			
		||||
    public virtual byte[] GetBytes(ulong value)
 | 
			
		||||
    {
 | 
			
		||||
        return ByteTransDataFormat8(BitConverter.GetBytes(value));
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(ulong[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(ulong[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -208,12 +208,12 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(float value)
 | 
			
		||||
    public virtual byte[] GetBytes(float value)
 | 
			
		||||
    {
 | 
			
		||||
        return ByteTransDataFormat4(BitConverter.GetBytes(value));
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(float[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(float[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -224,12 +224,12 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(double value)
 | 
			
		||||
    public virtual byte[] GetBytes(double value)
 | 
			
		||||
    {
 | 
			
		||||
        return ByteTransDataFormat8(BitConverter.GetBytes(value));
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(double[] value)
 | 
			
		||||
    public virtual byte[] GetBytes(double[] value)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = new byte[value.Length * 2];
 | 
			
		||||
        for (int index = 0; index < value.Length; ++index)
 | 
			
		||||
@@ -240,7 +240,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] GetBytes(string value)
 | 
			
		||||
    public virtual byte[] GetBytes(string value)
 | 
			
		||||
    {
 | 
			
		||||
        if (value == null)
 | 
			
		||||
        {
 | 
			
		||||
@@ -280,7 +280,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public bool IsSameOfSet()
 | 
			
		||||
    public virtual bool IsSameOfSet()
 | 
			
		||||
    {
 | 
			
		||||
        return !(BitConverter.IsLittleEndian ^ (endianType == EndianType.Little));
 | 
			
		||||
    }
 | 
			
		||||
@@ -288,7 +288,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public bool ToBoolean(byte[] buffer, int offset)
 | 
			
		||||
    public virtual bool ToBoolean(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = new byte[buffer.Length];
 | 
			
		||||
        Array.Copy(buffer, 0, bytes, 0, buffer.Length);
 | 
			
		||||
@@ -296,7 +296,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte ToByte(byte[] buffer, int offset)
 | 
			
		||||
    public virtual byte ToByte(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = new byte[1];
 | 
			
		||||
        Array.Copy(buffer, offset, bytes, 0, bytes.Length);
 | 
			
		||||
@@ -304,7 +304,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public byte[] ToByte(byte[] buffer, int offset, int length)
 | 
			
		||||
    public virtual byte[] ToByte(byte[] buffer, int offset, int length)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = new byte[length];
 | 
			
		||||
        Array.Copy(buffer, offset, bytes, 0, bytes.Length);
 | 
			
		||||
@@ -317,7 +317,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    /// <param name="buffer"></param>
 | 
			
		||||
    /// <param name="offset"></param>
 | 
			
		||||
    /// <returns></returns>
 | 
			
		||||
    public double ToDouble(byte[] buffer, int offset)
 | 
			
		||||
    public virtual double ToDouble(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = ByteTransDataFormat8(buffer, offset);
 | 
			
		||||
 | 
			
		||||
@@ -325,7 +325,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public short ToInt16(byte[] buffer, int offset)
 | 
			
		||||
    public virtual short ToInt16(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = new byte[2];
 | 
			
		||||
        Array.Copy(buffer, offset, bytes, 0, bytes.Length);
 | 
			
		||||
@@ -337,7 +337,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public int ToInt32(byte[] buffer, int offset)
 | 
			
		||||
    public virtual int ToInt32(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = ByteTransDataFormat4(buffer, offset);
 | 
			
		||||
 | 
			
		||||
@@ -345,14 +345,14 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public long ToInt64(byte[] buffer, int offset)
 | 
			
		||||
    public virtual long ToInt64(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = ByteTransDataFormat8(buffer, offset);
 | 
			
		||||
        return BitConverter.ToInt64(bytes, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public float ToSingle(byte[] buffer, int offset)
 | 
			
		||||
    public virtual float ToSingle(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = ByteTransDataFormat4(buffer, offset);
 | 
			
		||||
 | 
			
		||||
@@ -360,13 +360,13 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public string ToString(byte[] buffer)
 | 
			
		||||
    public virtual string ToString(byte[] buffer)
 | 
			
		||||
    {
 | 
			
		||||
        return ToString(buffer, 0, buffer.Length);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public string ToString(byte[] buffer, int offset, int length)
 | 
			
		||||
    public virtual string ToString(byte[] buffer, int offset, int length)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] numArray = buffer.SelectMiddle(offset, length);
 | 
			
		||||
        if (BcdFormat != null)
 | 
			
		||||
@@ -385,7 +385,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public ushort ToUInt16(byte[] buffer, int offset)
 | 
			
		||||
    public virtual ushort ToUInt16(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = new byte[2];
 | 
			
		||||
        Array.Copy(buffer, offset, bytes, 0, 2);
 | 
			
		||||
@@ -397,7 +397,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public uint ToUInt32(byte[] buffer, int offset)
 | 
			
		||||
    public virtual uint ToUInt32(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = ByteTransDataFormat4(buffer, offset);
 | 
			
		||||
 | 
			
		||||
@@ -405,7 +405,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public ulong ToUInt64(byte[] buffer, int offset)
 | 
			
		||||
    public virtual ulong ToUInt64(byte[] buffer, int offset)
 | 
			
		||||
    {
 | 
			
		||||
        byte[] bytes = ByteTransDataFormat8(buffer, offset);
 | 
			
		||||
        return BitConverter.ToUInt64(bytes, 0);
 | 
			
		||||
@@ -508,7 +508,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public bool[] ToBoolean(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual bool[] ToBoolean(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        bool[] flagArray = new bool[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -519,7 +519,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public double[] ToDouble(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual double[] ToDouble(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        double[] numArray = new double[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -530,7 +530,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public short[] ToInt16(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual short[] ToInt16(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        short[] numArray = new short[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -541,7 +541,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public int[] ToInt32(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual int[] ToInt32(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        int[] numArray = new int[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -552,7 +552,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public long[] ToInt64(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual long[] ToInt64(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        long[] numArray = new long[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -562,7 +562,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
        return numArray;
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public float[] ToSingle(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual float[] ToSingle(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        float[] numArray = new float[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -573,7 +573,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public ushort[] ToUInt16(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual ushort[] ToUInt16(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        ushort[] numArray = new ushort[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -584,7 +584,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public uint[] ToUInt32(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual uint[] ToUInt32(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        uint[] numArray = new uint[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
@@ -595,7 +595,7 @@ public class ThingsGatewayBitConverter : IThingsGatewayBitConverter
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public ulong[] ToUInt64(byte[] buffer, int offset, int len)
 | 
			
		||||
    public virtual ulong[] ToUInt64(byte[] buffer, int offset, int len)
 | 
			
		||||
    {
 | 
			
		||||
        ulong[] numArray = new ulong[len];
 | 
			
		||||
        for (int index = 0; index < len; ++index)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,146 +0,0 @@
 | 
			
		||||
#region copyright
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
//  此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
 | 
			
		||||
//  此代码版权(除特别声明外的代码)归作者本人Diego所有
 | 
			
		||||
//  源代码使用协议遵循本仓库的开源协议及附加协议
 | 
			
		||||
//  Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
 | 
			
		||||
//  Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
 | 
			
		||||
//  使用文档:https://diego2098.gitee.io/thingsgateway-docs/
 | 
			
		||||
//  QQ群:605534569
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
 | 
			
		||||
using ThingsGateway.Foundation.Serial;
 | 
			
		||||
 | 
			
		||||
namespace ThingsGateway.Foundation.Adapter.DLT645;
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// DLT645_2007
 | 
			
		||||
/// </summary>
 | 
			
		||||
public class DLT645_2007 : ReadWriteDevicesSerialBase
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DLT645_2007
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="serialClient"></param>
 | 
			
		||||
    public DLT645_2007(SerialClient serialClient) : base(serialClient)
 | 
			
		||||
    {
 | 
			
		||||
        ThingsGatewayBitConverter = new ThingsGatewayBitConverter(EndianType.Big);
 | 
			
		||||
        RegisterByteLength = 2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 组包缓存时间/ms
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [Description("组包缓存时间ms")]
 | 
			
		||||
    public int CacheTimeout { get; set; } = 1000;
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Crc校验
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [Description("Crc校验")]
 | 
			
		||||
    public bool Crc16CheckEnable { get; set; } = true;
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 帧前时间ms
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [Description("帧前时间ms")]
 | 
			
		||||
    public int FrameTime { get; set; }
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 站号
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [Description("站号")]
 | 
			
		||||
    public byte Station { get; set; } = 1;
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override string GetAddressDescription()
 | 
			
		||||
    {
 | 
			
		||||
        return base.GetAddressDescription() + Environment.NewLine + ModbusHelper.GetAddressDescription();
 | 
			
		||||
    }
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override async Task<OperResult<byte[]>> ReadAsync(string address, int length, CancellationToken token = default)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await ConnectAsync(token);
 | 
			
		||||
            var commandResult = ModbusHelper.GetReadModbusCommand(address, length, Station);
 | 
			
		||||
            if (commandResult.IsSuccess)
 | 
			
		||||
            {
 | 
			
		||||
                ResponsedData result = await SendThenReturnAsync(commandResult, token);
 | 
			
		||||
                return (MessageBase)result.RequestInfo;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                return OperResult.CreateFailedResult<byte[]>(commandResult);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            return new OperResult<byte[]>(ex);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override void SetDataAdapter()
 | 
			
		||||
    {
 | 
			
		||||
        ModbusRtuDataHandleAdapter dataHandleAdapter = new()
 | 
			
		||||
        {
 | 
			
		||||
            Crc16CheckEnable = Crc16CheckEnable,
 | 
			
		||||
            CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
 | 
			
		||||
        };
 | 
			
		||||
        SerialClient.SetDataHandlingAdapter(dataHandleAdapter);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override async Task<OperResult> WriteAsync(string address, byte[] value, CancellationToken token = default)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await ConnectAsync(token);
 | 
			
		||||
            var commandResult = ModbusHelper.GetWriteModbusCommand(address, value, Station);
 | 
			
		||||
            if (commandResult.IsSuccess)
 | 
			
		||||
            {
 | 
			
		||||
                ResponsedData result = await SendThenReturnAsync(commandResult, token);
 | 
			
		||||
                return (MessageBase)result.RequestInfo;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                return OperResult.CreateFailedResult<bool[]>(commandResult);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            return new OperResult<bool[]>(ex);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override async Task<OperResult> WriteAsync(string address, bool[] value, CancellationToken token = default)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await ConnectAsync(token);
 | 
			
		||||
            var commandResult = ModbusHelper.GetWriteBoolModbusCommand(address, value, Station);
 | 
			
		||||
            if (commandResult.IsSuccess)
 | 
			
		||||
            {
 | 
			
		||||
                ResponsedData result = await SendThenReturnAsync(commandResult, token);
 | 
			
		||||
                return (MessageBase)result.RequestInfo;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                return OperResult.CreateFailedResult<bool[]>(commandResult);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            return new OperResult<bool[]>(ex);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task<ResponsedData> SendThenReturnAsync(OperResult<byte[]> commandResult, CancellationToken token)
 | 
			
		||||
    {
 | 
			
		||||
        var item = commandResult.Content;
 | 
			
		||||
        await Task.Delay(FrameTime, token);
 | 
			
		||||
        var result = await WaitingClientEx.SendThenResponseAsync(item, TimeOut, token);
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,60 +0,0 @@
 | 
			
		||||
#region copyright
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
//  此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
 | 
			
		||||
//  此代码版权(除特别声明外的代码)归作者本人Diego所有
 | 
			
		||||
//  源代码使用协议遵循本仓库的开源协议及附加协议
 | 
			
		||||
//  Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
 | 
			
		||||
//  Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
 | 
			
		||||
//  使用文档:https://diego2098.gitee.io/thingsgateway-docs/
 | 
			
		||||
//  QQ群:605534569
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace ThingsGateway.Foundation.Adapter.Modbus;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Rtu适配器
 | 
			
		||||
/// </summary>
 | 
			
		||||
public class ModbusRtuDataHandleAdapter : ReadWriteDevicesTcpDataHandleAdapter<ModbusRtuMessage>
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 检测CRC
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public bool Crc16CheckEnable { get; set; } = true;
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="command"></param>
 | 
			
		||||
    /// <returns></returns>
 | 
			
		||||
    public override byte[] PackCommand(byte[] command)
 | 
			
		||||
    {
 | 
			
		||||
        return ModbusHelper.AddCrc(command);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    protected override ModbusRtuMessage GetInstance()
 | 
			
		||||
    {
 | 
			
		||||
        return new ModbusRtuMessage();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    protected override FilterResult UnpackResponse(ModbusRtuMessage request, byte[] send, byte[] body, byte[] response)
 | 
			
		||||
    {
 | 
			
		||||
        //理想状态检测
 | 
			
		||||
        var result = ModbusHelper.GetModbusRtuData(send, response, Crc16CheckEnable);
 | 
			
		||||
        if (result.IsSuccess)
 | 
			
		||||
        {
 | 
			
		||||
            request.ResultCode = result.ResultCode;
 | 
			
		||||
            request.Message = result.Message;
 | 
			
		||||
            request.Content = result.Content1;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            request.ResultCode = result.ResultCode;
 | 
			
		||||
            request.Message = result.Message;
 | 
			
		||||
        }
 | 
			
		||||
        return result.Content2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,34 +0,0 @@
 | 
			
		||||
#region copyright
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
//  此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
 | 
			
		||||
//  此代码版权(除特别声明外的代码)归作者本人Diego所有
 | 
			
		||||
//  源代码使用协议遵循本仓库的开源协议及附加协议
 | 
			
		||||
//  Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
 | 
			
		||||
//  Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
 | 
			
		||||
//  使用文档:https://diego2098.gitee.io/thingsgateway-docs/
 | 
			
		||||
//  QQ群:605534569
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace ThingsGateway.Foundation.Adapter.Modbus;
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// <inheritdoc/>
 | 
			
		||||
/// </summary>
 | 
			
		||||
public class ModbusRtuMessage : MessageBase, IMessage
 | 
			
		||||
{
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override int HeadBytesLength => -1;
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override bool CheckHeadBytes(byte[] head)
 | 
			
		||||
    {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    protected override void SendBytesThen()
 | 
			
		||||
    {
 | 
			
		||||
        BodyLength = -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
#region copyright
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
//  此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
 | 
			
		||||
//  此代码版权(除特别声明外的代码)归作者本人Diego所有
 | 
			
		||||
//  源代码使用协议遵循本仓库的开源协议及附加协议
 | 
			
		||||
//  Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
 | 
			
		||||
//  Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
 | 
			
		||||
//  使用文档:https://diego2098.gitee.io/thingsgateway-docs/
 | 
			
		||||
//  QQ群:605534569
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
global using System;
 | 
			
		||||
global using System.Linq;
 | 
			
		||||
global using System.Threading;
 | 
			
		||||
global using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
global using TouchSocket.Core;
 | 
			
		||||
global using TouchSocket.Sockets;
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<!--<GenerateDocumentationFile>True</GenerateDocumentationFile>-->
 | 
			
		||||
		<TargetFrameworks>net45;netstandard2.0;net6.0;net7.0</TargetFrameworks>
 | 
			
		||||
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
	  <ProjectReference Include="..\..\..\ThingsGateway.Foundation\ThingsGateway.Foundation.csproj" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
@@ -60,45 +60,92 @@ public class ModbusAddress : DeviceAddressBase
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override void Parse(string address, int length)
 | 
			
		||||
    {
 | 
			
		||||
        Length = length;
 | 
			
		||||
        if (address.IndexOf(';') < 0)
 | 
			
		||||
        var result = ParseFrom(address, length);
 | 
			
		||||
        if (result.IsSuccess)
 | 
			
		||||
        {
 | 
			
		||||
            Address(address);
 | 
			
		||||
 | 
			
		||||
            Length = result.Content.Length;
 | 
			
		||||
            AddressStart = result.Content.AddressStart;
 | 
			
		||||
            ReadFunction = result.Content.ReadFunction;
 | 
			
		||||
            Station = result.Content.Station;
 | 
			
		||||
            WriteFunction = result.Content.WriteFunction;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
    }
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 解析地址
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="address"></param>
 | 
			
		||||
    /// <param name="length"></param>
 | 
			
		||||
    /// <returns></returns>
 | 
			
		||||
    public static OperResult<ModbusAddress> ParseFrom(string address, int length)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            string[] strArray = address.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
 | 
			
		||||
            for (int index = 0; index < strArray.Length; ++index)
 | 
			
		||||
            ModbusAddress modbusAddress = new ModbusAddress();
 | 
			
		||||
 | 
			
		||||
            modbusAddress.Length = length;
 | 
			
		||||
            if (address.IndexOf(';') < 0)
 | 
			
		||||
            {
 | 
			
		||||
                if (strArray[index].ToUpper().StartsWith("S="))
 | 
			
		||||
                Address(address);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                string[] strArray = address.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
 | 
			
		||||
                for (int index = 0; index < strArray.Length; ++index)
 | 
			
		||||
                {
 | 
			
		||||
                    if (Convert.ToInt16(strArray[index].Substring(2)) > 0)
 | 
			
		||||
                        Station = byte.Parse(strArray[index].Substring(2));
 | 
			
		||||
                }
 | 
			
		||||
                else if (strArray[index].ToUpper().StartsWith("W="))
 | 
			
		||||
                {
 | 
			
		||||
                    if (Convert.ToInt16(strArray[index].Substring(2)) > 0)
 | 
			
		||||
                        this.WriteFunction = byte.Parse(strArray[index].Substring(2));
 | 
			
		||||
                }
 | 
			
		||||
                else if (!strArray[index].Contains("="))
 | 
			
		||||
                {
 | 
			
		||||
                    Address(strArray[index]);
 | 
			
		||||
                    if (strArray[index].ToUpper().StartsWith("S="))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Convert.ToInt16(strArray[index].Substring(2)) > 0)
 | 
			
		||||
                            modbusAddress.Station = byte.Parse(strArray[index].Substring(2));
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (strArray[index].ToUpper().StartsWith("W="))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Convert.ToInt16(strArray[index].Substring(2)) > 0)
 | 
			
		||||
                            modbusAddress.WriteFunction = byte.Parse(strArray[index].Substring(2));
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (!strArray[index].Contains("="))
 | 
			
		||||
                    {
 | 
			
		||||
                        Address(strArray[index]);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void Address(string address)
 | 
			
		||||
            return OperResult.CreateSuccessResult(modbusAddress);
 | 
			
		||||
 | 
			
		||||
            void Address(string address)
 | 
			
		||||
            {
 | 
			
		||||
                var readF = ushort.Parse(address.Substring(0, 1));
 | 
			
		||||
                if (readF > 4)
 | 
			
		||||
                    throw new("功能码错误");
 | 
			
		||||
                switch (readF)
 | 
			
		||||
                {
 | 
			
		||||
                    case 0:
 | 
			
		||||
                        modbusAddress.ReadFunction = 1;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case 1:
 | 
			
		||||
                        modbusAddress.ReadFunction = 2;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case 3:
 | 
			
		||||
                        modbusAddress.ReadFunction = 4;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case 4:
 | 
			
		||||
                        modbusAddress.ReadFunction = 3;
 | 
			
		||||
                        break;
 | 
			
		||||
                }
 | 
			
		||||
                modbusAddress.AddressStart = int.Parse(address.Substring(1)) - 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            var readF = ushort.Parse(address.Substring(0, 1));
 | 
			
		||||
            if (readF > 4)
 | 
			
		||||
                throw new("功能码错误");
 | 
			
		||||
            GetFunction(readF);
 | 
			
		||||
            AddressStart = int.Parse(address.Substring(1)) - 1;
 | 
			
		||||
            return new OperResult<ModbusAddress>(ex);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override string ToString()
 | 
			
		||||
    {
 | 
			
		||||
@@ -115,24 +162,6 @@ public class ModbusAddress : DeviceAddressBase
 | 
			
		||||
        return stringGeter.ToString();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void GetFunction(ushort readF)
 | 
			
		||||
    {
 | 
			
		||||
        switch (readF)
 | 
			
		||||
        {
 | 
			
		||||
            case 0:
 | 
			
		||||
                ReadFunction = 1;
 | 
			
		||||
                break;
 | 
			
		||||
            case 1:
 | 
			
		||||
                ReadFunction = 2;
 | 
			
		||||
                break;
 | 
			
		||||
            case 3:
 | 
			
		||||
                ReadFunction = 4;
 | 
			
		||||
                break;
 | 
			
		||||
            case 4:
 | 
			
		||||
                ReadFunction = 3;
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    private string GetFunctionString(int readF)
 | 
			
		||||
    {
 | 
			
		||||
        return readF switch
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,14 @@
 | 
			
		||||
        <member name="M:ThingsGateway.Foundation.Adapter.Modbus.ModbusAddress.Parse(System.String,System.Int32)">
 | 
			
		||||
            <inheritdoc/>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:ThingsGateway.Foundation.Adapter.Modbus.ModbusAddress.ParseFrom(System.String,System.Int32)">
 | 
			
		||||
            <summary>
 | 
			
		||||
            解析地址
 | 
			
		||||
            </summary>
 | 
			
		||||
            <param name="address"></param>
 | 
			
		||||
            <param name="length"></param>
 | 
			
		||||
            <returns></returns>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:ThingsGateway.Foundation.Adapter.Modbus.ModbusAddress.ToString">
 | 
			
		||||
            <inheritdoc/>
 | 
			
		||||
        </member>
 | 
			
		||||
 
 | 
			
		||||
@@ -56,11 +56,13 @@ public class RabbitMQClientProperty : UpDriverPropertyBase
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [DeviceProperty("虚拟Host", "")]
 | 
			
		||||
    public string VirtualHost { get; set; } = ConnectionFactory.DefaultVHost;
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// RoutingKey
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [DeviceProperty("路由名称", "")]
 | 
			
		||||
    public string RoutingKey { get; set; } = "TG";
 | 
			
		||||
 | 
			
		||||
    ///// <summary>
 | 
			
		||||
    ///// RoutingKey
 | 
			
		||||
    ///// </summary>
 | 
			
		||||
    //[DeviceProperty("路由名称", "")]
 | 
			
		||||
    //public string RoutingKey { get; set; } = "TG";
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 交换机名称
 | 
			
		||||
    /// </summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -85,11 +85,6 @@
 | 
			
		||||
            VirtualHost
 | 
			
		||||
            </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="P:ThingsGateway.RabbitMQ.RabbitMQClientProperty.RoutingKey">
 | 
			
		||||
            <summary>
 | 
			
		||||
            RoutingKey
 | 
			
		||||
            </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="P:ThingsGateway.RabbitMQ.RabbitMQClientProperty.ExchangeName">
 | 
			
		||||
            <summary>
 | 
			
		||||
            交换机名称
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user