public static void Decompress(DLCBase dlcBase, string inputPath, string outputPath) { using (var input = File.OpenRead(inputPath)) { int count = 1; foreach (sfarFile entry in dlcBase.fileList) { string entryName = entry.fileName; if (entryName == null) { if (extractUnknowns == false) { continue; } entryName = entry.nameHash.ToString(); entryName = Path.Combine("__UNKNOWN", entryName); } else { entryName = entryName.Replace("/", "\\"); if (entryName.StartsWith("\\") == true) { entryName = entryName.Substring(1); } } var entryPath = Path.Combine(outputPath, entryName); if (overwriteFiles == false && File.Exists(entryPath) == true) { continue; } if (verbose == true) { Console.WriteLine("[{0}/{1}] {2}", count++, dlcBase.numOfFiles, entry.nameHash); } input.Seek(entry.dataOffset[0], SeekOrigin.Begin); Directory.CreateDirectory(Path.GetDirectoryName(entryPath)); using (var output = File.Create(entryPath)) { DecompressEntry(entry, input, output, dlcBase.CompressionScheme); } } } }
public DLCEditor(DLCBase dlcBase) { this.dlcBase = dlcBase; listAdd = new SortedDictionary <FileNameHash, add>(); listReplace = new SortedDictionary <FileNameHash, string>(); listDelete = new SortedDictionary <FileNameHash, string>(); listComplete = new SortedDictionary <FileNameHash, action>(); blockSizeCount = (int)(this.dlcBase.dataOffset - this.dlcBase.blockTableOffset) / 2; foreach (sfarFile entry in dlcBase.fileList) { listComplete.Add(entry.nameHash, action.copy); } //listComplete.Add(DLCBase.fileListHash, action.copy); }