示例#1
0
        public string ReadString()
        {
            string value = serializer.ReadString();
            int    len   = Encoding.UTF8.GetByteCount(value);

            while (((len++) % 4) != 0)
            {
                serializer.ReadByte();
            }
            return(value);
        }
示例#2
0
        /*private Room ReadRoom()
         * {
         *
         *  ushort attrLength = serializer.ReadUShort();
         *  byte[] byteRoom = serializer.ReadBytes(attrLength);
         *  while ((serializer.bytePos < serializer.byteLength) && ((attrLength++) % 4) != 0)
         *      serializer.ReadByte();
         *  Room r = Room.FromByteArray(byteRoom);
         *  Console.WriteLine("ReadRoom: " + r.ToString());
         *  return r;
         * }*/
        private string ReadString()
        {
            ushort attrLength = serializer.ReadUShort();

            if (attrLength == 0)
            {
                return("");
            }
            string ret = serializer.ReadString(attrLength);

            while ((serializer.bytePos < serializer.byteLength) && ((attrLength++) % 4) != 0)
            {
                serializer.ReadByte();
            }
            return(ret);
        }