PHP Code:
private static readonly AsyncLocal<MemoryStream> localMemoryStream = new AsyncLocal<MemoryStream>();
// Only FileHeader, ApplyOption, Sqpk, and EOF have been observed in XIVARR+ patches
// AddDirectory and DeleteDirectory can theoretically happen, so they're implemented
// ApplyFreeSpace doesn't seem to show up anymore, and EntryFile will just error out
private static readonly Dictionary<string, Func<ChecksumBinaryReader, int, ZiPatchChunk>> ChunkTypes =
new Dictionary<string, Func<ChecksumBinaryReader, int, ZiPatchChunk>> {
{ FileHeaderChunk.Type, (reader, size) => new FileHeaderChunk(reader, size) },
{ ApplyOptionChunk.Type, (reader, size) => new ApplyOptionChunk(reader, size) },
{ ApplyFreeSpaceChunk.Type, (reader, size) => new ApplyFreeSpaceChunk(reader, size) },
{ AddDirectoryChunk.Type, (reader, size) => new AddDirectoryChunk(reader, size) },
{ DeleteDirectoryChunk.Type, (reader, size) => new DeleteDirectoryChunk(reader, size) },
{ SqpkChunk.Type, SqpkChunk.GetCommand },
{ EndOfFileChunk.Type, (reader, size) => new EndOfFileChunk(reader, size) },
{ XXXXChunk.Type, (reader, size) => new XXXXChunk(reader, size) }
};