public void UncompressPackage(string packagePath, string outputPath) { if (outputPath.Length > 0 && outputPath.Last() != '/' && outputPath.Last() != '\\') outputPath += "/"; this.progressUpdate("Reading package headers ...", 0, 1); var reader = new PackageReader(packagePath); var package = reader.Read(); long totalSize = package.Files.Sum(p => (long)p.Size()); long currentSize = 0; foreach (var file in package.Files) { this.progressUpdate(file.Name, currentSize, totalSize); currentSize += file.Size(); var outPath = outputPath + file.Name; var dirName = Path.GetDirectoryName(outPath); if (!Directory.Exists(dirName)) { Directory.CreateDirectory(dirName); } var inReader = file.MakeReader(); var outFile = new FileStream(outPath, FileMode.Create, FileAccess.Write); if (inReader != null) { byte[] buffer = new byte[32768]; int read; while ((read = inReader.Read(buffer, 0, buffer.Length)) > 0) { outFile.Write(buffer, 0, read); } inReader.Dispose(); } outFile.Dispose(); } reader.Dispose(); }