예제 #1
0
        public static VariableLengthPayload.CursorWritingContext StartWriting(MemoryCursor cursor, int offset)
        {
            FrameType.Crypto.Write(cursor);

            cursor.EncodeVariable32(offset);

            return(VariableLengthPayload.StartWriting(cursor));
        }
예제 #2
0
        public static bool TryParse(MemoryCursor cursor, out CryptoFrame result)
        {
            result = new CryptoFrame();

            if (!FrameType.TrySlice(cursor, FrameType.Crypto))
            {
                return(false);
            }

            var offset = cursor.DecodeVariable32();
            var data   = VariableLengthPayload.SliceBytes(cursor);

            result = new CryptoFrame(offset, data);

            return(true);
        }