Beispiel #1
0
        private static KeyValuePair <AVPairKey, byte[]> ReadAVPair(byte[] buffer, ref int offset)
        {
            AVPairKey key    = (AVPairKey)LittleEndianReader.ReadUInt16(buffer, ref offset);
            ushort    length = LittleEndianReader.ReadUInt16(buffer, ref offset);

            byte[] value = ByteReader.ReadBytes(buffer, ref offset, length);
            return(new KeyValuePair <AVPairKey, byte[]>(key, value));
        }
Beispiel #2
0
        public static KeyValuePairList <AVPairKey, byte[]> ReadAVPairSequence(byte[] buffer, int offset)
        {
            KeyValuePairList <AVPairKey, byte[]> result = new KeyValuePairList <AVPairKey, byte[]>();
            AVPairKey key = (AVPairKey)LittleEndianConverter.ToUInt16(buffer, offset);

            while (key != AVPairKey.EOL)
            {
                KeyValuePair <AVPairKey, byte[]> pair = ReadAVPair(buffer, ref offset);
                result.Add(pair);
                key = (AVPairKey)LittleEndianConverter.ToUInt16(buffer, offset);
            }

            return(result);
        }
Beispiel #3
0
 private static void WriteAVPair(byte[] buffer, ref int offset, AVPairKey key, byte[] value)
 {
     LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)key);
     LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)value.Length);
     ByteWriter.WriteBytes(buffer, ref offset, value);
 }