本文整理汇总了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;
示例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:");
}
}