/// <summary> /// Extract a package in one step, treating the manifest like any other file. /// </summary> /// <param name="packagePath">The full file path of the package.</param> /// <param name="rsaParamsXml">RSA key serialized to XML. If null, extract an unencrypted package.</param> /// <param name="targetFolderPath">The folder where the file should be extracted to. This folder will be created if needed. Any existing file will be overwritten.</param> public static void ExtractAllFiles(string packagePath, string rsaParamsXml, string targetFolderPath) { TemplatePackage package = new TemplatePackage(); package.Open(packagePath, rsaParamsXml); foreach (var s in package.GetFiles(true)) { package.ExtractFile(s, targetFolderPath); } }
/// <summary> /// Extract a package in one step. /// </summary> /// <param name="packagePath">The full file path of the package.</param> /// <param name="rsaParamsXml">RSA key serialized to XML. If null, extract an unencrypted package.</param> /// <param name="targetFolderPath">The folder where the file should be extracted to. This folder will be created if needed. Any existing file will be overwritten.</param> /// <param name="manifest">The manifest of the package. If null, the package had no manifest.</param> /// <param name="filePaths">A list containing the full file paths of all extracted files.</param> public static void Extract(string packagePath, string rsaParamsXml, string targetFolderPath, out TemplatePackageManifest manifest, out IEnumerable <string> filePaths) { TemplatePackage package = new TemplatePackage(); List <string> fileList = new List <string>(); string path; // package.Open(packagePath, rsaParamsXml); foreach (var s in package.GetFiles()) { path = package.ExtractFile(s, targetFolderPath); fileList.Add(path); } manifest = package.Manifest; filePaths = fileList; }
/// <summary> /// Extract a package in one step. /// </summary> /// <param name="packagePath">The full file path of the package.</param> /// <param name="rsaParamsXml">RSA key serialized to XML. If null, extract an unencrypted package.</param> /// <param name="targetFolderPath">The folder where the file should be extracted to. This folder will be created if needed. Any existing file will be overwritten.</param> /// <param name="manifest">The manifest of the package. If null, the package had no manifest.</param> /// <param name="filePaths">A list containing the full file paths of all extracted files.</param> public static void Extract(string packagePath, string rsaParamsXml, string targetFolderPath, out TemplatePackageManifest manifest, out IEnumerable<string> filePaths) { TemplatePackage package = new TemplatePackage(); List<string> fileList = new List<string>(); string path; // package.Open(packagePath, rsaParamsXml); foreach (var s in package.GetFiles()) { path = package.ExtractFile(s, targetFolderPath); fileList.Add(path); } manifest = package.Manifest; filePaths = fileList; }