本文整理汇总了C#中ZipEntry.IsZip64Forced方法的典型用法代码示例。如果您正苦于以下问题:C# ZipEntry.IsZip64Forced方法的具体用法?C# ZipEntry.IsZip64Forced怎么用?C# ZipEntry.IsZip64Forced使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZipEntry
的用法示例。
在下文中一共展示了ZipEntry.IsZip64Forced方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteCentralDirectoryHeader
int WriteCentralDirectoryHeader(ZipEntry entry)
{
if ( entry.CompressedSize < 0 ) {
throw new ZipException("Attempt to write central directory entry with unknown csize");
}
if ( entry.Size < 0 ) {
throw new ZipException("Attempt to write central directory entry with unknown size");
}
if ( entry.Crc < 0 ) {
throw new ZipException("Attempt to write central directory entry with unknown crc");
}
// Write the central file header
WriteLEInt(ZipConstants.CentralHeaderSignature);
// Version made by
WriteLEShort(ZipConstants.VersionMadeBy);
// Version required to extract
WriteLEShort(entry.Version);
WriteLEShort(entry.Flags);
unchecked {
WriteLEShort((byte)entry.CompressionMethod);
WriteLEInt((int)entry.DosTime);
WriteLEInt((int)entry.Crc);
}
if ( (entry.IsZip64Forced()) || (entry.CompressedSize >= 0xffffffff) ) {
WriteLEInt(-1);
}
else {
WriteLEInt((int)(entry.CompressedSize & 0xffffffff));
}
if ( (entry.IsZip64Forced()) || (entry.Size >= 0xffffffff) ) {
WriteLEInt(-1);
}
else {
WriteLEInt((int)entry.Size);
}
byte[] name = ZipConstants.ConvertToArray(entry.Flags, entry.Name);
if ( name.Length > 0xFFFF ) {
throw new ZipException("Entry name is too long.");
}
WriteLEShort(name.Length);
// Central header extra data is different to local header version so regenerate.
ZipExtraData ed = new ZipExtraData(entry.ExtraData);
if ( entry.CentralHeaderRequiresZip64 ) {
ed.StartNewEntry();
if ( (entry.Size >= 0xffffffff) || (useZip64_ == UseZip64.On) )
{
ed.AddLeLong(entry.Size);
}
if ( (entry.CompressedSize >= 0xffffffff) || (useZip64_ == UseZip64.On) )
{
ed.AddLeLong(entry.CompressedSize);
}
if ( entry.Offset >= 0xffffffff ) {
ed.AddLeLong(entry.Offset);
}
// Number of disk on which this file starts isnt supported and is never written here.
ed.AddNewEntry(1);
}
else {
// Should have already be done when local header was added.
ed.Delete(1);
}
byte[] centralExtraData = ed.GetEntryData();
WriteLEShort(centralExtraData.Length);
WriteLEShort(entry.Comment != null ? entry.Comment.Length : 0);
WriteLEShort(0); // disk number
WriteLEShort(0); // internal file attributes
// External file attributes...
if ( entry.ExternalFileAttributes != -1 ) {
WriteLEInt(entry.ExternalFileAttributes);
}
else {
if ( entry.IsDirectory ) {
WriteLEUint(16);
}
else {
WriteLEUint(0);
}
//.........这里部分代码省略.........