HTML5技术

免费开源的.NET多类型文件解压缩组件SharpZipLib(.NET组件介绍之七) - 彭泽0902(2)

字号+ 作者:H5之家 来源:H5之家 2016-12-14 12:00 我要评论( )

Finish(){ if ( this .entries != null ){ if ( this .curEntry != null ){ this .CloseEntry();} long count = this .entries.Count; long sizeEntries = 0L ; foreach (ZipEntry entry in this .entries){ this .

Finish() { if (this.entries != null) { if (this.curEntry != null) { this.CloseEntry(); } long count = this.entries.Count; long sizeEntries = 0L; foreach (ZipEntry entry in this.entries) { this.WriteLeInt(0x2014b50); this.WriteLeShort(0x33); this.WriteLeShort(entry.Version); this.WriteLeShort(entry.Flags); this.WriteLeShort((short) entry.CompressionMethodForHeader); this.WriteLeInt((int) entry.DosTime); this.WriteLeInt((int) entry.Crc); if (entry.IsZip64Forced() || (entry.CompressedSize >= 0xffffffffL)) { this.WriteLeInt(-1); } else { this.WriteLeInt((int) entry.CompressedSize); } if (entry.IsZip64Forced() || (entry.Size >= 0xffffffffL)) { this.WriteLeInt(-1); } else { this.WriteLeInt((int) entry.Size); } byte[] buffer = ZipConstants.ConvertToArray(entry.Flags, entry.Name); if (buffer.Length > 0xffff) { ); } ZipExtraData extraData = new ZipExtraData(entry.ExtraData); if (entry.CentralHeaderRequiresZip64) { extraData.StartNewEntry(); if (entry.IsZip64Forced() || (entry.Size >= 0xffffffffL)) { extraData.AddLeLong(entry.Size); } if (entry.IsZip64Forced() || (entry.CompressedSize >= 0xffffffffL)) { extraData.AddLeLong(entry.CompressedSize); } if (entry.Offset >= 0xffffffffL) { extraData.AddLeLong(entry.Offset); } extraData.AddNewEntry(1); } else { extraData.Delete(1); } if (entry.AESKeySize > 0) { AddExtraDataAES(entry, extraData); } byte[] entryData = extraData.GetEntryData(); byte[] buffer3 = (entry.Comment != null) ? ZipConstants.ConvertToArray(entry.Flags, entry.Comment) : new byte[0]; if (buffer3.Length > 0xffff) { ); } this.WriteLeShort(buffer.Length); this.WriteLeShort(entryData.Length); this.WriteLeShort(buffer3.Length); this.WriteLeShort(0); this.WriteLeShort(0); if (entry.ExternalFileAttributes != -1) { this.WriteLeInt(entry.ExternalFileAttributes); } else if (entry.IsDirectory) { this.WriteLeInt(0x10); } else { this.WriteLeInt(0); } if (entry.Offset >= 0xffffffffL) { this.WriteLeInt(-1); } else { this.WriteLeInt((int) entry.Offset); } if (buffer.Length > 0) { base.baseOutputStream_.Write(buffer, 0, buffer.Length); } if (entryData.Length > 0) { base.baseOutputStream_.Write(entryData, 0, entryData.Length); } if (buffer3.Length > 0) { base.baseOutputStream_.Write(buffer3, 0, buffer3.Length); } sizeEntries += ((0x2e + buffer.Length) + entryData.Length) + buffer3.Length; } using (ZipHelperStream stream = new ZipHelperStream(base.baseOutputStream_)) { stream.WriteEndOfCentralDirectory(count, sizeEntries, this.offset, this.zipComment); } this.entries = null; } }

    3.ZipEntry类Clone():

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 【.net 深呼吸】细说CodeDom(2):表达式、语句 - 东邪独孤

    【.net 深呼吸】细说CodeDom(2):表达式、语句 - 东邪独孤

    2016-12-13 12:00

  • Qt实现FlatUI样式(开源) - 飞扬青云

    Qt实现FlatUI样式(开源) - 飞扬青云

    2016-12-13 11:01

  • .NET Core 首例 Office 开源跨平台组件(NPOI Core) - Savorboard

    .NET Core 首例 Office 开源跨平台组件(NPOI Core) - Savorboard

    2016-12-08 13:00

  • 高品质开源工具Chloe.ORM:支持存储过程与Oracle - 我叫So

    高品质开源工具Chloe.ORM:支持存储过程与Oracle - 我叫So

    2016-12-08 12:00

网友点评
"