コード例 #1
0
        public static IList <KeyValuePair <long, byte[]> > Decode(FrameIterator iterator)
        {
            var listV = ListMultiFrameCodec.Decode(iterator, ByteArrayCodec.Decode);
            var listK = ListLongCodec.Decode(iterator);

            var result = new List <KeyValuePair <long, byte[]> >(listV.Count);

            for (var i = 0; i < listK.Count; i++)
            {
                result.Add(new KeyValuePair <long, byte[]>(listK[i], listV[i]));
            }

            return(result);
        }
コード例 #2
0
        public static void Encode(ClientMessage clientMessage, IEnumerable <KeyValuePair <long, byte[]> > collection)
        {
            var valueList = new List <long>();

            clientMessage.Add(BeginFrame.Copy());

            foreach (var kvp in collection)
            {
                valueList.Add(kvp.Key);
                ByteArrayCodec.Encode(clientMessage, kvp.Value);
            }

            clientMessage.Add(EndFrame);
            ListLongCodec.Encode(clientMessage, valueList);
        }