public PayloadParser() { Size = new FrameSegement(); Size.Buffer = _lengthBuffer; BodyDataType = new Frame(); Body = new Frame(); }
public void SetBuffer(byte[] buffer) { /* 8 is the minimum total size length of the datatype & data */ if (buffer.Length < 8) throw new ArgumentException("buffer length must be greater than 8."); _buffer = buffer; _payloadlength = buffer.Length; int dataTypeLength = BitConverter.ToInt32(buffer, 0); BodyDataType = new Frame(buffer, 0, 4 + dataTypeLength); int dataOffset = 4 + dataTypeLength; int dataLength = _payloadlength - dataOffset; Body = new Frame(buffer, dataOffset, dataLength); }