Ejemplo n.º 1
0
        /// <summary> 產生一個<see cref="WzSound"/>的拷貝 </summary>
        public override WzSerialize Clone()
        {
            WzSound sound = new WzSound(this.Name);

            sound.Unknow1_Byte = this.Unknow1_Byte;
            sound.DataSize     = this.DataSize;
            sound.Duration     = this.Duration;
            sound.Unknow3_Byte = this.Unknow3_Byte;

            WzMediaType wzmt = this.MediaType;

            wzmt.pbFormat = new byte[sound.MediaType.cbFormat];
            this.MediaType.pbFormat.CopyTo(sound.MediaType.pbFormat, 0);
            sound.MediaType  = wzmt;
            sound.mSoundData = new byte[sound.DataSize];
            this.SoundData.CopyTo(sound.mSoundData, 0);

            return(sound);
        }
Ejemplo n.º 2
0
        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);
        }