internal override bool Read(WzFileStream stream) { this.Unknow1_Byte = stream.Read1u(); bool hasProperty = stream.ReadBool(); if (hasProperty) { this.CanvasProperty.Read(stream); } this.Width = stream.Read4(true); this.Height = stream.Read4(true); this.Format = (WzCanvasFormat)stream.Read4(true); this.Scale = stream.Read1u(); this.Unknow2_Int = stream.Read4(); this.DataSize = stream.Read4(); this.mCanvasOffset = (uint)stream.Tell(); if (stream.DynamicRead) { stream.Skip(this.DataSize); this.mStream = stream; } else { this.CanvasData = this.ResolveData(stream); } return(true); }
private byte[] ResolveData(WzFileStream zs) { byte unk = zs.Read1u(); byte cmf = zs.Read1u(); byte flg = zs.Read1u(); zs.Skip(-3); if (CanvasZlibTool.CheckDeflate(unk, cmf, flg)) { return(zs.Read(this.DataSize)); } else { using (MemoryStream ms = new MemoryStream()) { ms.WriteByte(zs.Read1u()); for (int i = 1; i < this.DataSize;) { int blocksize = zs.Read4(); ms.Write(zs.Read(blocksize, true), 0, blocksize); i += blocksize + 4; } return(ms.ToArray()); } } }
internal override bool Read(WzFileStream stream) { this.Unknow1_Byte = stream.Read1u(); this.DataSize = stream.Read4(true); this.Duration = stream.Read4(true); this.Unknow3_Byte = stream.Read1u(); WzMediaType wzmt = new WzMediaType(); wzmt.Read(stream); this.MediaType = wzmt; this.mSoundOffset = (uint)stream.Tell(); if (stream.DynamicRead) { this.mStream = stream; stream.Skip(this.DataSize); } else { this.SoundData = stream.Read(this.DataSize); } return(true); }