当前位置: 首页>>代码示例>>C#>>正文


C# ZipFile.ExtractAll方法代码示例

本文整理汇总了C#中Ionic.Zip.ZipFile.ExtractAll方法的典型用法代码示例。如果您正苦于以下问题:C# ZipFile.ExtractAll方法的具体用法?C# ZipFile.ExtractAll怎么用?C# ZipFile.ExtractAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ionic.Zip.ZipFile的用法示例。


在下文中一共展示了ZipFile.ExtractAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            using (var Site = new SPSite("http://epm2007demo/pwa04"))
            {
                SPList List = Site.RootWeb.Lists["Shared Documents"];
                foreach (SPListItem item in List.Items)
                {
                    if (item.FileSystemObjectType == SPFileSystemObjectType.File)
                    {
                        byte[] bytes = item.Folder.Files[0].OpenBinary();
                        var writer = new FileStream("c:\\text.docx", FileMode.OpenOrCreate);
                        writer.Write(bytes, 0, bytes.Length);
                        writer.Flush();
                        writer.Close();
                    }
                }
            }
            return;
            using (var zip = new ZipFile(@"C:\Documents and Settings\Administrator\Desktop\ITXWorkflowAppDeployment\Batch_Installer.zip"))
            {
                zip.ExtractAll(Environment.ExpandEnvironmentVariables("%temp%"));
            }

            return;
            foreach (var directory in Directory.GetDirectories(@"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"))
            {
                string[] dirs = directory.Split('\\');
                string curdir = dirs[dirs.Length - 1];
            }

            return;
        }
开发者ID:Santhoshonet,项目名称:ITXWorkflowAutomaticDeployment,代码行数:32,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            var cwd = Environment.CurrentDirectory;

            //stop the agent service
            RunProcess(" /c  \"Agent.exe stop\" ");

            Console.WriteLine("agent stopped");

            Console.WriteLine(cwd);

            foreach (var file in Directory.EnumerateFiles(cwd).Where(x => !x.Contains("update.zip") && !x.Contains("Updater.exe") && !x.Contains("Ionic.Zip.dll"))){
                Console.WriteLine("deleteing "+file);
                File.Delete(file);
            }

            //extract the new version
            using (var zip = new ZipFile(Path.Combine(cwd, "update.zip")))
            {
                zip.TempFileFolder = System.IO.Path.GetTempPath();
                zip.ExtractAll(cwd, ExtractExistingFileAction.OverwriteSilently);
            }

            Console.WriteLine("files extracted");

            //clean update package
            System.IO.File.Delete(Path.Combine(cwd, "update.zip"));

            //start the agent service again
            RunProcess(" /c  \"Agent.exe start\" ");
        }
开发者ID:BazookaDeploy,项目名称:Bazooka,代码行数:31,代码来源:Program.cs

示例3: ExtractArchive

 /// <summary>
 /// Extracts the contents of the input archive and outputs its contents to the specified outputDirectoryPath
 /// </summary>
 public void ExtractArchive(string inputArchivePath, string outputDirectoryPath)
 {
     using (ZipFile zipFile = new ZipFile(inputArchivePath))
     {
         zipFile.ExtractAll(outputDirectoryPath);
     }
 }
开发者ID:zunath,项目名称:WinterEngine,代码行数:10,代码来源:FileArchiveManager.cs

示例4: UnzipFilesWithManifest

        /// <summary>
        /// Given the target folder, it will unzip any zips, and then send folders with imsmanifest.xml into manifest parser.
        /// </summary>
        /// <param name="topDirectory"></param>
        /// <param name="reportFile"></param>
        public static void UnzipFilesWithManifest(string topDirectory)
        {
            string[] zipsList = Directory.GetFiles(topDirectory, "*.zip");
            string extractionDestination;

            // Extract zips --------------------------------------------------------------------------------
            if (zipsList.Length > 0)
            {
                Console.WriteLine("---------- EXTRACTING ZIPS           ----------\n");
                for (int i = 0; i < zipsList.Length; i++)
                {
                    ZipFile zipFolder = new ZipFile(zipsList[i]);
                    // Generate extact folder name
                    extractionDestination = zipFolder.Name.Replace(".zip", "");

                    // If that folder already exists, skip
                    if (!Directory.Exists(extractionDestination))
                    {
                        Console.WriteLine("About to extract  " + zipFolder.Name);
                        // If the zipFile doesn't have the manifest, don't extract. There won't be a manifest to parse
                        if (zipFolder.ContainsEntry("imsmanifest.xml"))
                        {
                            zipFolder.ExtractAll(extractionDestination);
                            Console.WriteLine("\tExtracted " + zipFolder.Name + "\n");
                        }
                        else
                        {
                            Console.WriteLine("\tManifest file was not found\n");
                        }
                    }
                }
                Console.WriteLine("---------- FINISHED EXTRACTING ZIPS  ----------\n\n");
            }
        }
开发者ID:babyworm1,项目名称:CourseAuditorC-,代码行数:39,代码来源:CourseAuditor.cs

示例5: unzip

 public static void unzip(string zipFileName, string outputDirectory)
 {
     Console.WriteLine("Unzipping '{0}' to '{1}'", zipFileName, outputDirectory);
     using (var zip = new ZipFile(zipFileName)) {
         zip.ExtractAll(outputDirectory);
     }
 }
开发者ID:JeremySkinner,项目名称:Phantom,代码行数:7,代码来源:ZipFunctions.cs

示例6: Extract

        public static void Extract(string directoryName)
        {
            if (Directory.Exists(directoryName))
            {
                try
                {
                    var archiveNameNoExtension = Path.Combine(directoryName, new DirectoryInfo(directoryName).Name);
                    var archiveName = Path.Combine(archiveNameNoExtension, "zip");

                    using (var zip = new ZipFile(archiveName))
                    {
                        zip.ExtractProgress += (s, e) =>
                            {
                                var filePercentage = e.EntriesExtracted / e.EntriesTotal * 100;
                            };

                        zip.ExtractAll(directoryName);
                    }
                }
                catch (Exception ex)
                {
                    Logging.Logger.Log(Logging.SeverityGrades.Warning, string.Format("Archive extraction failed: {0}", ex.Message));
                }
            }
        }
开发者ID:worstward,项目名称:rlviewer,代码行数:25,代码来源:Compressor.cs

示例7: Extract

 public void Extract(string destinationFolderPath)
 {
     using (var zip = new ZipFile(this.Path))
     {
         zip.ExtractAll(destinationFolderPath, this.ExtractionStrategy);
     }
 }
开发者ID:Team-Mercury,项目名称:Databases-2015-Teamwork,代码行数:7,代码来源:Unzipper.cs

示例8: extract_all_to_fldr

 public bool extract_all_to_fldr(string archive_path, string destination_path)
 {
     if (archive_path != "" & File.Exists(archive_path))
     {
         if (Directory.Exists(destination_path) == false) { Directory.CreateDirectory(destination_path); };
         try
         {
             using (ZipFile zip1 = new ZipFile(archive_path))
             {
                 zip1.ExtractAll(destination_path, ExtractExistingFileAction.OverwriteSilently);
             }
         }
         catch (Exception exc1)
         {
             MessageBox.Show(String.Format("Ошибка при разархивировании zip-файла", exc1.Message));
             return false;
             // throw;
         }
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:developer88,项目名称:umk,代码行数:25,代码来源:cls_filesystem.cs

示例9: OnExecute

		/// <summary>
		/// Do the unzip.
		/// </summary>
		protected override void OnExecute(ServerCommandProcessor theProcessor)
		{
			using (ZipFile zip = new ZipFile(_zipFile))
			{
				zip.ExtractAll(_destinationFolder,_overwrite);
			}
		}
开发者ID:fparisotto,项目名称:ClearCanvas-Contrib,代码行数:10,代码来源:ExtractZipCommand.cs

示例10: bgWorker_Finish

        private void bgWorker_Finish(object sender, RunWorkerCompletedEventArgs e)
        {
            dlElapsedTimer.Stop();
            try
            {
                if (File.Exists(zipTarget))
                {
                    using (ZipFile zip = new ZipFile(zipTarget))
                    {
                        zip.ExtractAll(Directory.GetCurrentDirectory(), ExtractExistingFileAction.OverwriteSilently);
                        zip.Dispose();
                    }

                    File.Delete(zipTarget);
                    Process start = new Process();
                    start.StartInfo.FileName = exeTarget;
                    start.StartInfo.Arguments = "ProcessStart.cs";
                    start.Start();
                    Application.Exit();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an error with the updater. Check your connection and try running as an administrator.\r\n\r\n" + ex.Message);
                Application.Exit();
            }
        }
开发者ID:Frostbrood,项目名称:StealthClient,代码行数:27,代码来源:Updater.cs

示例11: ExtrairArquivoZip

        /// <summary>
        /// Extraindo informações do "Zip" e colocando na pasta do software.
        /// </summary>
        /// <param name="localizacaoArquivoZip"></param>
        /// <param name="destino"></param>
        public void ExtrairArquivoZip(string localizacaoArquivoZip, string destino)
        {
            if (File.Exists(localizacaoArquivoZip))
            {
                //recebe a localização do arquivo zip
                ZipFile zip = new ZipFile(localizacaoArquivoZip);
                {
                    //verifica se o destino existe
                    if (Directory.Exists(destino))
                    {
                        try
                        {
                            //extrai o arquivo zip para o destino
                            zip.ExtractAll(destino);
                        }
                        catch
                        {

                        }
                    }
                    else
                    {
                        //lança uma exceção se o destino não existe
                        throw new DirectoryNotFoundException("O arquivo destino não foi localizado");
                    }
                }
            }
            else
            {
                //lança uma exceção se a origem não existe
                throw new FileNotFoundException("O Arquivo Zip não foi localizado");
            }
        }
开发者ID:wind39,项目名称:SoftwareOrdemDeServico,代码行数:38,代码来源:ControllerBackup.cs

示例12: ExtractTemplate

 protected virtual void ExtractTemplate()
 {
     string zipPath = Path.Combine(ProjectBuilder.ZipFileFolder, ProjectTemplateFile);
     using (ZipFile zipFile = new ZipFile(zipPath))
     {
         zipFile.ExtractAll(ProjectDirectory, ExtractExistingFileAction.DoNotOverwrite);
     }
 }
开发者ID:cmcginn,项目名称:AIM,代码行数:8,代码来源:ProjectCreator.cs

示例13: GivenIUnzipThatPackageIntoADeploymentFolder

 public void GivenIUnzipThatPackageIntoADeploymentFolder()
 {
     var folder = (string)ScenarioContext.Current["targetFolder"];
     if (Directory.Exists(folder)) 
         Directory.Delete(folder, true);
     var zip = new ZipFile((string)ScenarioContext.Current["targetZip"]);
     zip.ExtractAll(folder);
     zip.Dispose();
 }
开发者ID:AtwooTM,项目名称:opencover,代码行数:9,代码来源:PackagingSteps.cs

示例14: ExtractFile

		public void ExtractFile(string zipPath, string targetDirectory)
		{
			using(var zipFile = new ZipFile(zipPath))
			{
				_logger.Debug(string.Format("Extracting file {0} to directory {1}", zipPath, targetDirectory));
				zipFile.ExtractAll(targetDirectory);
				_logger.Debug(string.Format("Done extracting file {0} to to directory {1}", zipPath, targetDirectory));
			}
		}
开发者ID:gsbastian,项目名称:Sriracha.Deploy,代码行数:9,代码来源:Zipper.cs

示例15: ExtractXapToTempLocation

 private static void ExtractXapToTempLocation(string xapLocation, string pathtoExtractAssembliesTo)
 {
     if (Directory.Exists(pathtoExtractAssembliesTo)) Directory.Delete(pathtoExtractAssembliesTo, true);
     Directory.CreateDirectory(pathtoExtractAssembliesTo);
     using (var file = new ZipFile(xapLocation))
     {
         file.ExtractAll(pathtoExtractAssembliesTo, ExtractExistingFileAction.OverwriteSilently);
     }
 }
开发者ID:LSudarshan,项目名称:SilverlightProfiler,代码行数:9,代码来源:Instrument.cs


注:本文中的Ionic.Zip.ZipFile.ExtractAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。