本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.ZipEntry.IsZip64Forced方法的典型用法代码示例。如果您正苦于以下问题:C# ZipEntry.IsZip64Forced方法的具体用法?C# ZipEntry.IsZip64Forced怎么用?C# ZipEntry.IsZip64Forced使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpZipLib.Zip.ZipEntry
的用法示例。
在下文中一共展示了ZipEntry.IsZip64Forced方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
WriteLEInt(ZipConstants.CentralHeaderSignature);
WriteLEShort(ZipConstants.VersionMadeBy);
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);
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);
}
ed.AddNewEntry(1);
}
else {
ed.Delete(1);
}
byte[] centralExtraData = ed.GetEntryData();
WriteLEShort(centralExtraData.Length);
WriteLEShort(entry.Comment != null ? entry.Comment.Length : 0);
WriteLEShort(0);
WriteLEShort(0);
if ( entry.ExternalFileAttributes != -1 ) {
WriteLEInt(entry.ExternalFileAttributes);
}
else {
if ( entry.IsDirectory ) {
WriteLEUint(16);
}
else {
WriteLEUint(0);
}
}
if ( entry.Offset >= 0xffffffff ) {
WriteLEUint(0xffffffff);
}
else {
WriteLEUint((uint)(int)entry.Offset);
//.........这里部分代码省略.........
示例2: 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);
}
//.........这里部分代码省略.........
示例3: WriteCentralDirectoryHeader
private int WriteCentralDirectoryHeader(ZipEntry entry)
{
if (entry.CompressedSize < 0L)
{
throw new ZipException("Attempt to write central directory entry with unknown csize");
}
if (entry.Size < 0L)
{
throw new ZipException("Attempt to write central directory entry with unknown size");
}
if (entry.Crc < 0L)
{
throw new ZipException("Attempt to write central directory entry with unknown crc");
}
this.WriteLEInt(0x2014b50);
this.WriteLEShort(0x33);
this.WriteLEShort(entry.Version);
this.WriteLEShort(entry.Flags);
this.WriteLEShort((byte) entry.CompressionMethod);
this.WriteLEInt((int) entry.DosTime);
this.WriteLEInt((int) entry.Crc);
if (entry.IsZip64Forced() || (entry.CompressedSize >= 0xffffffffL))
{
this.WriteLEInt(-1);
}
else
{
this.WriteLEInt((int) (((ulong) entry.CompressedSize) & 0xffffffffL));
}
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)
{
throw new ZipException("Entry name is too long.");
}
this.WriteLEShort(buffer.Length);
ZipExtraData data = new ZipExtraData(entry.ExtraData);
if (entry.CentralHeaderRequiresZip64)
{
data.StartNewEntry();
if ((entry.Size >= 0xffffffffL) || (this.useZip64_ == ICSharpCode.SharpZipLib.Zip.UseZip64.On))
{
data.AddLeLong(entry.Size);
}
if ((entry.CompressedSize >= 0xffffffffL) || (this.useZip64_ == ICSharpCode.SharpZipLib.Zip.UseZip64.On))
{
data.AddLeLong(entry.CompressedSize);
}
if (entry.Offset >= 0xffffffffL)
{
data.AddLeLong(entry.Offset);
}
data.AddNewEntry(1);
}
else
{
data.Delete(1);
}
byte[] entryData = data.GetEntryData();
this.WriteLEShort(entryData.Length);
this.WriteLEShort((entry.Comment != null) ? entry.Comment.Length : 0);
this.WriteLEShort(0);
this.WriteLEShort(0);
if (entry.ExternalFileAttributes != -1)
{
this.WriteLEInt(entry.ExternalFileAttributes);
}
else if (entry.IsDirectory)
{
this.WriteLEUint(0x10);
}
else
{
this.WriteLEUint(0);
}
if (entry.Offset >= 0xffffffffL)
{
this.WriteLEUint(uint.MaxValue);
}
else
{
this.WriteLEUint((uint) ((int) entry.Offset));
}
if (buffer.Length > 0)
{
this.baseStream_.Write(buffer, 0, buffer.Length);
}
if (entryData.Length > 0)
{
this.baseStream_.Write(entryData, 0, entryData.Length);
}
byte[] buffer3 = (entry.Comment != null) ? Encoding.ASCII.GetBytes(entry.Comment) : new byte[0];
if (buffer3.Length > 0)
//.........这里部分代码省略.........