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


C# ZipFile.UpdateSelectedFiles方法代码示例

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


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

示例1: Main


//.........这里部分代码省略.........
                                break;

                            case "-cp":
                                i++;
                                if (args.Length <= i) Usage();
                                System.Int32.TryParse(args[i], out codePage);
                                if (codePage != 0)
                                {
                                    zip.AlternateEncoding = System.Text.Encoding.GetEncoding(codePage);
                                    zip.AlternateEncodingUsage = ZipOption.Always;
                                }
                                break;

                            case "-d":
                                i++;
                                if (args.Length <= i) Usage();
                                entryDirectoryPathInArchive = args[i];
                                break;

                            case "-D":
                                i++;
                                if (args.Length <= i) Usage();
                                directoryOnDisk = args[i];
                                break;

                            case "-E":
                                i++;
                                if (args.Length <= i) Usage();
                                wantRecurse = recurseDirectories || args[i].Contains("\\");
                                // Console.WriteLine("spec({0})", args[i]);
                                // Console.WriteLine("dir({0})", directoryOnDisk);
                                // Console.WriteLine("dirInArc({0})", entryDirectoryPathInArchive);
                                // Console.WriteLine("recurse({0})", recurseDirectories);
                                zip.UpdateSelectedFiles(args[i],
                                                        directoryOnDisk,
                                                        entryDirectoryPathInArchive,
                                                        wantRecurse);
                                break;

                            case "-j-":
                                zip.AddDirectoryWillTraverseReparsePoints = false;
                                break;

                            case "-j+":
                                zip.AddDirectoryWillTraverseReparsePoints = true;
                                break;

                            case "-L":
                                i++;
                                if (args.Length <= i) Usage();
                                zip.CompressionLevel = (Ionic.Zlib.CompressionLevel)
                                    System.Int32.Parse(args[i]);
                                break;

                            case "-p":
                                i++;
                                if (args.Length <= i) Usage();
                                zip.Password = (args[i] == "") ? null : args[i];
                                break;

                            case "-progress":
                                wantProgressReports = true;
                                break;

                            case "-r-":
                                recurseDirectories = false;
开发者ID:ahjohannessen,项目名称:DotNetZip.Semverd,代码行数:67,代码来源:ZipIt.cs

示例2: Update_FromRoot_wi11988

        public void Update_FromRoot_wi11988()
        {
            string zipFileToCreate = "FromRoot.zip";
            string dirToZip = "Fodder";
            var files = TestUtilities.GenerateFilesFlat(dirToZip);
            string windir = System.Environment.GetEnvironmentVariable("Windir");
            string substExe = Path.Combine(Path.Combine(windir, "system32"), "subst.exe");
            Assert.IsTrue(File.Exists(substExe), "subst.exe does not exist ({0})",
                          substExe);

            try
            {
                // create a subst drive
                this.Exec(substExe, "G: " + dirToZip);

                using (var zip = new ZipFile())
                {
                    zip.UpdateSelectedFiles("*.*", "G:\\", "", true);
                    zip.Save(zipFileToCreate);
                }

                Assert.AreEqual<int>(TestUtilities.CountEntries(zipFileToCreate),
                                     files.Length);
                Assert.IsTrue(files.Length > 3);
                BasicVerifyZip(zipFileToCreate);
            }
            finally
            {
                // remove the virt drive
                this.Exec(substExe, "/D G:");
            }
        }
开发者ID:Matttapestry,项目名称:DotNetZip.Semverd,代码行数:32,代码来源:UpdateTests.cs


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