Gurux.DLMS.GXByteBuffer.Compare C# (CSharp) Method

Compare() public method

Compares, whether two given arrays are similar starting from current position.
public Compare ( byte arr ) : bool
arr byte Array to compare.
return bool
        public bool Compare(byte[] arr)
        {
            if (arr == null || Size - Position < arr.Length)
            {
                return false;
            }
            byte[] bytes = new byte[arr.Length];
            Get(bytes);
            bool ret = Gurux.DLMS.Internal.GXCommon.Compare(bytes, arr);
            if (!ret)
            {
                this.Position -= arr.Length;
            }
            return ret;
        }

Usage Example

Exemplo n.º 1
0
 /// <summary>
 ///  Check LLC bytes.
 /// </summary>
 /// <param name="server">Is server.</param>
 /// <param name="data">Received data.</param>
 private static bool GetLLCBytes(bool server,
                                 GXByteBuffer data)
 {
     if (server)
     {
         return data.Compare(GXCommon.LLCSendBytes);
     }
     return data.Compare(GXCommon.LLCReplyBytes);
 }