private void CreateMDXChunks() { var calculatedSize = CalculateChunkSize(MDXFilenames); adt.AddEmptyBytes(adtPos, (int)calculatedSize + 8); adt.WriteHeaderMagic("MMDX", ref adtPos); adt.WriteUInt(calculatedSize, ref adtPos); foreach (var filename in MDXFilenames.Values) { adt.WriteString(filename, ref adtPos); } adt.AddEmptyBytes(adtPos, (MDXFilenames.Count * 4) + 8); adt.WriteHeaderMagic("MMID", ref adtPos); adt.WriteInt(MDXFilenames.Count * 4, ref adtPos); var mdxFilenames = MDXFilenames.Values.ToList(); var lastMDX = string.Empty; foreach (var filename in mdxFilenames) { if (lastMDX == string.Empty) { adt.WriteInt(0, ref adtPos); } else { adt.WriteInt(lastMDX.Length, ref adtPos); } lastMDX = filename; } }