private static void ExtractFile(IndexFile index, string file, string outputDirectory, bool flat) { var content = index.GetFile(file); var outputFilePath = Path.Combine(outputDirectory, flat ? Path.GetFileName(file) : file); Directory.CreateDirectory(Path.GetDirectoryName(outputFilePath)); File.WriteAllBytes(outputFilePath, content.ToArray()); }