示例#1
0
        // For WZDirectory
        internal string DirectoryRead(out WzArchiveItemType type, WzArchiveItemType reftype)
        {
            uint off = (uint)this.mStream.Tell(true);

            type = (WzArchiveItemType)this.mStream.Read1u();
            if (type == reftype)
            {
                uint cacheoff = this.mStream.Read4u();
                long org      = this.mStream.Tell();
                this.mStream.Seek(cacheoff, true);
                type = (WzArchiveItemType)this.mStream.Read1u();
                this.mStream.Seek(org);
                return(this.mStrTable[cacheoff]);
            }
            else
            {
                string str = SerializeString.Read(this.mStream);
                this.mStrTable.Add(off, str);
                return(str);
            }
        }
示例#2
0
        /// <summary> 讀取一串序列化文字。如果池裡面已經存在同樣的字串,會從池裡面讀取 </summary>
        public string Read()
        {
            byte header = this.mStream.Read1u();

            switch (header)
            {
            case 0x00:     // normal serialize string
            case 0x73:     // class  serialize string
                uint   off = (uint)this.mStream.Tell(true);
                string str = SerializeString.Read(this.mStream);
                this.mStrTable.Add(off, str);
                return(str);

            case 0x01:     // reference normal serialize string
            case 0x1B:     // reference class  serialize string
                return(this.mStrTable[this.mStream.Read4u()]);

            default:

                throw new ArgumentException("invalid header : " + header);
            }
        }