Esempio n. 1
0
 public void append(byte[] data, int count)
 {
     //this.data = new byte[count];
     //Array.Copy(data, data, count);
     //data.Copy(data,count);
     statdata.Clear();
     statdata.Set(data, count);
 }
Esempio n. 2
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);
        }
Esempio n. 3
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());
            }
        }
Esempio n. 4
0
        public void UnMarshal(MMStream stream)
        {
            num = stream.ReadUInt32();

            eids.Clear();

            eds.SetUsedLength((int)num);

            for (int i = 0; i < num; i++)
            {
                eids.Add(stream.ReadUInt64());

                //int blen = stream.ReadUInt16();

                var edsbytearr = eds.getArray()[i];
                if (edsbytearr == null)
                {
                    eds.getArray()[i] = new FixedLengthArray <byte>(2048);
                    edsbytearr        = eds.getArray()[i];
                }

                stream.ReadFixByteArray(ref edsbytearr);
            }
        }