internal void DirectoryWrite(string str, WzArchiveItemType type, WzArchiveItemType cachetype) { bool cacheable = false; bool hascache = this.mRefTable.ContainsKey(str); long org = this.mStream.Tell(true); if (hascache) { this.mStream.Seek(this.mRefTable[str], true); cacheable = this.mStream.Read1u() == (byte)type; this.mStream.Seek(org, true); } this.mStream.Write1u((byte)(cacheable ? cachetype : type)); if (cacheable) { this.mStream.Write4u(this.mRefTable[str]); } else { this.mRefTable.Add(str, (uint)org); SerializeString.Write(this.mStream, str); } }
/// <summary> </summary> public WzArchiveItem(string name, WzArchiveItemType type) { this.Type = type; this.Name = name; this.Offset = 0; this.Checksum = 0; this.Size = 0; this.Archive = null; this.Parent = null; }
// 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); } }