示例#1
0
        static void UnzipTo(string vsixPath, string path)
        {
            var decompressor = new ZipFileDecompressor(vsixPath);

            decompressor.UncompressToFolder(path);
            decompressor.Close();
        }
示例#2
0
        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();
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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();
                }
            }
        }
示例#6
0
文件: Program.cs 项目: jaredpar/VsVim
 static void UnzipTo(string vsixPath, string path)
 {
     var decompressor = new ZipFileDecompressor(vsixPath);
     decompressor.UncompressToFolder(path);
     decompressor.Close();
 }