BrickPi.Brick.CheckRetMessage C# (CSharp) Method

CheckRetMessage() private method

Check if the returned buffer is all correct
private CheckRetMessage ( byte InArray, byte msg, byte &OutArray, int OutArrayLength = 256 ) : bool
InArray byte input array
msg byte the message to test
OutArray byte the array as an ouput
OutArrayLength int number of bytes for the return array
return bool
        private bool CheckRetMessage(byte[] InArray, byte msg, out byte[] OutArray, int OutArrayLength = 256)
        {
            OutArray = null;
            if (InArray == null)
                return false;
            if (InArray.Length == 1)
                return false;
            //is the value really changed? 
            if (!(InArray[BYTE_MSG_TYPE] == msg))
                return false;
            if (OutArrayLength < InArray.Length)
                return false;
            //saved new data to the main buffer
            OutArray = new byte[OutArrayLength];
            for (int i = 0; i < InArray.Length; i++)
                OutArray[i] = InArray[i];
            //all good!
            return true;

        }