本文整理汇总了C#中Ionic.Zip.ZipFile.OnReadEntry方法的典型用法代码示例。如果您正苦于以下问题:C# ZipFile.OnReadEntry方法的具体用法?C# ZipFile.OnReadEntry怎么用?C# ZipFile.OnReadEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ionic.Zip.ZipFile
的用法示例。
在下文中一共展示了ZipFile.OnReadEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadCentralDirectory
private static void ReadCentralDirectory(ZipFile zf)
{
// We must have the central directory footer record, in order to properly
// read zip dir entries from the central directory. This because the logic
// knows when to open a spanned file when the volume number for the central
// directory differs from the volume number for the zip entry. The
// _diskNumberWithCd was set when originally finding the offset for the
// start of the Central Directory.
// workitem 9214
bool inputUsesZip64 = false;
ZipEntry de;
// in lieu of hashset, use a dictionary
var previouslySeen = new Dictionary<String,object>();
while ((de = ZipEntry.ReadDirEntry(zf, previouslySeen)) != null)
{
de.ResetDirEntry();
zf.OnReadEntry(true, null);
if (zf.Verbose)
zf.StatusMessageTextWriter.WriteLine("entry {0}", de.FileName);
zf._entries.Add(de.FileName,de);
// workitem 9214
if (de._InputUsesZip64) inputUsesZip64 = true;
previouslySeen.Add(de.FileName, null); // to prevent dupes
}
// workitem 9214; auto-set the zip64 flag
if (inputUsesZip64) zf.UseZip64WhenSaving = Zip64Option.Always;
// workitem 8299
if (zf._locEndOfCDS > 0)
zf.ReadStream.Seek(zf._locEndOfCDS, SeekOrigin.Begin);
ReadCentralDirectoryFooter(zf);
if (zf.Verbose && !String.IsNullOrEmpty(zf.Comment))
zf.StatusMessageTextWriter.WriteLine("Zip file Comment: {0}", zf.Comment);
// We keep the read stream open after reading.
if (zf.Verbose)
zf.StatusMessageTextWriter.WriteLine("read in {0} entries.", zf._entries.Count);
zf.OnReadCompleted();
}