public void Write(string path) { var stream = File.Open(path, FileMode.Create); var writer = new MarkedBinaryWriter(stream); writer.Write(0x32465052); // RPF2 writer.Mark("tocSize"); writer.Write(0); writer.Mark("numEntries"); writer.Write(0); writer.Write(0); writer.Write(0); // not encrypted; for now writer.Align(2048); // write a TOC for the file RootEntry.Write(writer); RootEntry.WriteSubEntries(writer); RootEntry.WriteNames(writer); writer.WriteMark("numEntries", (uint)writer.WriteIdx); writer.Align(2048); // this has to be aligned or it will be cut off by 16 byte align writer.WriteMark("tocSize", (uint)stream.Position - 2048); RootEntry.WriteFiles(writer); writer.Close(); }
internal void WriteFiles(MarkedBinaryWriter writer) { if (!IsDirectory) { writer.WriteMark("fOff_" + Name, ((uint)writer.BaseStream.Position & 0xffffff00) | ResourceVersion); writer.Write(FileData); writer.Align(2048); } foreach (var entry in m_subEntries) { entry.WriteFiles(writer); } }
internal void WriteFiles(MarkedBinaryWriter writer) { if (!IsDirectory) { writer.WriteMark("fOff_" + Name, ((uint)writer.BaseStream.Position & 0xffffff00) | ResourceVersion); writer.Write(FileData); writer.Align(2048); } foreach (var entry in m_subEntries) { entry.WriteFiles(writer); } }