Beispiel #1
0
        public static List <long> Decode(ClientMessage.Frame frame)
        {
            var itemCount = frame.Content == null ? 0 : frame.Content.Length / Bits.LongSizeInBytes;
            var result    = new List <long>(itemCount);

            for (var i = 0; i < itemCount; i++)
            {
                result.Add(FixedSizeTypesCodec.DecodeLong(frame.Content, i * Bits.LongSizeInBytes));
            }
            return(result);
        }
Beispiel #2
0
        public static void Encode(ClientMessage clientMessage, IEnumerable <long> collection)
        {
            var itemCount = collection.Count();
            var frame     = new ClientMessage.Frame(new byte[itemCount * Bits.LongSizeInBytes]);

            var i = 0;

            foreach (var value in collection)
            {
                FixedSizeTypesCodec.EncodeLong(frame.Content, i * Bits.LongSizeInBytes, value);
                i++;
            }

            clientMessage.Add(frame);
        }