// private const int InitialFrameSize = ResponseBackupAcksFieldOffset + IntSizeInBytes;

        // public static ClientMessage Encode(List<ErrorHolder> errorHolders)
        // {
        //     var clientMessage = CreateForEncode();
        //     var initialFrame = new Frame(new byte[InitialFrameSize], UnfragmentedMessage);
        //     clientMessage.Add(initialFrame);
        //     clientMessage.MessageType = ExceptionMessageType;
        //     ListMultiFrameCodec.Encode(clientMessage, errorHolders, ErrorHolderCodec.Encode);
        //     return clientMessage;
        // }

        public static List <ErrorHolder> Decode(ClientMessage clientMessage)
        {
            var iterator = clientMessage.GetIterator();

            //initial frame
            iterator.Next();
            return(ListMultiFrameCodec.Decode(iterator, ErrorHolderCodec.Decode));
        }
        public static IList <KeyValuePair <Guid, IList <int> > > Decode(FrameIterator iterator)
        {
            var listV = ListMultiFrameCodec.Decode(iterator, ListIntegerCodec.Decode);
            var listK = ListUUIDCodec.Decode(iterator);

            var result = new List <KeyValuePair <Guid, IList <int> > >(listK.Count);

            for (var i = 0; i < listK.Count; i++)
            {
                result.Add(new KeyValuePair <Guid, IList <int> >(listK[i], listV[i]));
            }
            return(result);
        }
Пример #3
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);
        }