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 void Read(WzFileStream stream) { this.majortype = new Guid(stream.Read(16)); //MEDIATYPE_Stream this.subtype = new Guid(stream.Read(16)); //MEDIASUBTYPE_WAVE this.Unknow1_Byte = stream.Read1u(); this.Unknow2_Byte = stream.Read1u(); this.formattype = new Guid(stream.Read(16)); //WMFORMAT_WaveFormatEx if (this.formattype == SoundDX8Constants.WMFORMAT_WaveFormatEx) { this.cbFormat = (uint)stream.Read4(true); this.pbFormat = stream.Read((int)this.cbFormat); } }
/// <summary> 從指定的<see cref="WzFileStream"/>中讀取文字 </summary> public static string Read(WzFileStream stream) { int len = stream.Read1(); bool uni = len > 0; int flag = (uni ? len : ~len); if (len == 0) { return(""); } len = flag == 0x7F ? stream.Read4() : Math.Abs(len); byte[] str = stream.Read(len * (uni ? 2 : 1), true); Process(str, len, uni); return((uni ? Encoding.Unicode : Encoding.ASCII).GetString(str)); }
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); }