/// <summary> 使用外部的的<see cref="WzFileStream"/>儲存資料 </summary> public bool Write(WzFileStream zs) { this.Hash = HashTools.GenerateArchiveVersionHash(this.Version.ToString()); // header zs.Write(new byte[] { (byte)'P', (byte)'K', (byte)'G', (byte)'1' }, 4); zs.Write8(0); //Reserve zs.Write4u(0); //Reserve zs.WriteString(this.Description); // data long off = zs.Tell(); this.DataOffset = (uint)off; zs.BaseOffset = this.DataOffset; zs.Write2u((ushort)HashTools.EncryptArchiveVersionHash(this.Hash)); this.RootDirectory.Update(); this.RootDirectory.Write(zs); long endoff = zs.Tell(); // rewrite size, offset zs.Seek(4); zs.Write8(endoff - off); zs.Write4u((uint)off); // end write zs.Flush(); return(true); }