static void UnzipTo(string vsixPath, string path) { var decompressor = new ZipFileDecompressor(vsixPath); decompressor.UncompressToFolder(path); decompressor.Close(); }
private bool UnzipTemplate(string sourceZipFile, string unzipFolderPath) { // Try to unzip file to temp folder var compressor = new ZipFileDecompressor(sourceZipFile); try { tracer.Info( Resources.VsTemplateFileImporter_TraceUnzipTemplateFile, sourceZipFile, unzipFolderPath); compressor.UncompressToFolder(unzipFolderPath, true); return(true); } catch (ZipException ex) { tracer.Error( Resources.VsTemplateFileImporter_TraceFailedToUnzipToLocation, sourceZipFile, this.currentElement.InstanceName, unzipFolderPath, ex.Message); return(false); } finally { if (compressor != null) { compressor.Close(); } } }
private static string UncompressToTempDir(string templateFilename) { // Unzip temporarily to overwrite the .vstemplate later. var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); if (Directory.Exists(tempDir)) { Directory.Delete(tempDir, true); } if (File.Exists(tempDir)) { File.Delete(tempDir); } Directory.CreateDirectory(tempDir); var decompressor = new ZipFileDecompressor(templateFilename); try { decompressor.UncompressToFolder(tempDir); } finally { decompressor.Close(); decompressor = null; } return(tempDir); }
private static string UncompressToTempDir(string templateFilename) { // Unzip temporarily to overwrite the .vstemplate later. var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); if (File.Exists(tempDir)) File.Delete(tempDir); Directory.CreateDirectory(tempDir); var decompressor = new ZipFileDecompressor(templateFilename); try { decompressor.UncompressToFolder(tempDir); } finally { decompressor.Close(); decompressor = null; } return tempDir; }
private bool UnzipTemplate(string sourceZipFile, string unzipFolderPath) { // Try to unzip file to temp folder var compressor = new ZipFileDecompressor(sourceZipFile); try { tracer.Info( Resources.VsTemplateFileImporter_TraceUnzipTemplateFile, sourceZipFile, unzipFolderPath); compressor.UncompressToFolder(unzipFolderPath, true); return true; } catch (ZipException ex) { tracer.Error( Resources.VsTemplateFileImporter_TraceFailedToUnzipToLocation, sourceZipFile, this.currentElement.InstanceName, unzipFolderPath, ex.Message); return false; } finally { if (compressor != null) { compressor.Close(); } } }