示例#1
0
        public int ReadFixByteArray(ref FixedLengthArray <byte> data)
        {
            int dataActLen = ReadUInt16();

            if (data.totalLength < dataActLen)
            {
                throw new EndOfStreamException(string.Format("Capicity={0}, WPos={1}, RPos={2}", Capicity, WPos, RPos));
            }

            data.Clear();
            data.SetUsedLength(dataActLen);
            var arr = data.getArray();

            ReadBytes(ref arr, dataActLen);
            return(dataActLen + 2);
        }
示例#2
0
        public void UnMarshal(MMStream stream)
        {
            id = stream.ReadUInt64();

            linkTarget = stream.ReadUInt64();

            var linkLength = stream.ReadByte();

            if (linkLength <= linkers.totalLength)
            {
                linkers.Clear();
            }
            else
            {
                linkers = new FixedLengthArray <ulong>(linkLength);
            }
            for (int i = 0; i < linkLength; i++)
            {
                linkers.Add(stream.ReadUInt64());
            }

            commTarget = stream.ReadUInt64();

            var commLength = stream.ReadByte();

            if (commLength <= commers.totalLength)
            {
                commers.Clear();
            }
            else
            {
                commers = new FixedLengthArray <ulong>(commLength);
            }
            for (int i = 0; i < commLength; i++)
            {
                commers.Add(stream.ReadUInt64());
            }
        }
示例#3
0
 public void ResetByFixByteArray(FixedLengthArray <byte> fixbytes)
 {
     Reset(fixbytes.getArray(), fixbytes.usedLength);
 }