コード例 #1
0
        public SpanReader ReadAsSubReader(int length)
        {
            var reader = new SpanReader(_span.Slice(0, length));

            Advance(length);
            return(reader);
        }
コード例 #2
0
        public              Slot[] ReadAsSlotArray(int length)
        {
            var array     = new Slot[length];
            var subReader = new SpanReader(_span);

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = subReader.ReadAsSlot();
            }

            _span = subReader._span;
            return(array);
        }
コード例 #3
0
        public uint[] ReadAsVarIntArray(int length)
        {
            var array     = new uint[length];
            var subReader = new SpanReader(_span);

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = subReader.ReadAsVarInt(out _);
            }

            _span = subReader._span;
            return(array);
        }
コード例 #4
0
        public              T[] ReadAsArray <T>(int count)
            where T : IPacket, new()
        {
            var array     = new T[count];
            var subReader = new SpanReader(_span);

            for (int i = 0; i < array.Length; i++)
            {
                var item = new T();
                item.Deserialize(ref subReader);
                array[i] = item;
            }

            _span = subReader._span;
            return(array);
        }