Ejemplo n.º 1
0
        protected void WriteWaveTracks(RageDataFileWriteReference file)
        {
            if (this is RageAudioMetadata5)
            {
                var items = DataItems
                            .OfType <audSoundBase>()
                            .SelectMany(x => x.AudioTracks.BaseList.Select(y => x.FileOffset + y.Offset)).ToArray();

                file.Write(items.Length);

                foreach (var offset in items)
                {
                    file.Write(offset + 8);
                }
            }

            else
            {
                file.Write(WaveTracks.Length);

                foreach (var item in WaveTracks)
                {
                    file.Write(item.FileOffset + 8);
                }
            }
        }
Ejemplo n.º 2
0
        protected override void WriteDataOffsets(RageDataFileWriteReference file)
        {
            for (int i = 0; i < DataItems.Length; i++)
            {
                file.Write(DataItems[i].Name.HashKey);

                file.Write(DataItems[i].FileOffset);

                file.Write(DataItems[i].Serialize().Length);
            }
        }
Ejemplo n.º 3
0
        private void WriteStringSection(RageDataFileWriteReference file)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                using (IOBinaryWriter writer = new IOBinaryWriter(stream))
                {
                    for (int i = 0; i < StringTable.Length; i++)
                    {
                        file.Write((int)writer.BaseStream.Position); // write string offset

                        writer.WriteAnsi(StringTable[i]);
                    }
                }

                file.Write(stream.ToArray()); // write string data
            }
        }
Ejemplo n.º 4
0
        public virtual void Write(RageDataFileWriteReference file)
        {
            StringSectionSize = StringTable.Sum(str => str.Length + 5);

            CreateDataSection();

            file.Write((int)Type);

            file.Write(DataSection.Length);

            file.Write(DataSection);

            file.Write(StringSectionSize + 4);

            file.Write(StringTable.Length);

            WriteStringSection(file);

            file.Write(DataItems.Length);

            WriteDataOffsets(file);

            WriteWaveTracks(file);

            WriteWaveContainers(file);
        }