Exemple #1
0
 public ZipEntry(ZipEntry entry)
 {
     this.externalFileAttributes = -1;
     this.method = ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated;
     this.zipFileIndex = -1L;
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     this.known = entry.known;
     this.name = entry.name;
     this.size = entry.size;
     this.compressedSize = entry.compressedSize;
     this.crc = entry.crc;
     this.dosTime = entry.dosTime;
     this.method = entry.method;
     this.comment = entry.comment;
     this.versionToExtract = entry.versionToExtract;
     this.versionMadeBy = entry.versionMadeBy;
     this.externalFileAttributes = entry.externalFileAttributes;
     this.flags = entry.flags;
     this.zipFileIndex = entry.zipFileIndex;
     this.offset = entry.offset;
     this.forceZip64_ = entry.forceZip64_;
     if (entry.extra != null)
     {
         this.extra = new byte[entry.extra.Length];
         Array.Copy(entry.extra, 0, this.extra, 0, entry.extra.Length);
     }
 }
Exemple #2
0
 public ZipEntry(ZipEntry entry)
 {
     this.externalFileAttributes = -1;
     this.method       = ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated;
     this.zipFileIndex = -1L;
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     this.known                  = entry.known;
     this.name                   = entry.name;
     this.size                   = entry.size;
     this.compressedSize         = entry.compressedSize;
     this.crc                    = entry.crc;
     this.dosTime                = entry.dosTime;
     this.method                 = entry.method;
     this.comment                = entry.comment;
     this.versionToExtract       = entry.versionToExtract;
     this.versionMadeBy          = entry.versionMadeBy;
     this.externalFileAttributes = entry.externalFileAttributes;
     this.flags                  = entry.flags;
     this.zipFileIndex           = entry.zipFileIndex;
     this.offset                 = entry.offset;
     this.forceZip64_            = entry.forceZip64_;
     if (entry.extra != null)
     {
         this.extra = new byte[entry.extra.Length];
         Array.Copy(entry.extra, 0, this.extra, 0, entry.extra.Length);
     }
 }
Exemple #3
0

        
Exemple #4
0
 public static bool IsCompressionMethodSupported(ICSharpCode.SharpZipLib.Zip.CompressionMethod method)
 {
     if (method != ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated)
     {
         return(method == ICSharpCode.SharpZipLib.Zip.CompressionMethod.Stored);
     }
     return(true);
 }
Exemple #5
0
 internal ZipEntry(string name, int versionRequiredToExtract, int madeByInfo, ICSharpCode.SharpZipLib.Zip.CompressionMethod method)
 {
     this.externalFileAttributes = -1;
     this.method       = ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated;
     this.zipFileIndex = -1L;
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (name.Length > 0xffff)
     {
         throw new ArgumentException("Name is too long", "name");
     }
     if ((versionRequiredToExtract != 0) && (versionRequiredToExtract < 10))
     {
         throw new ArgumentOutOfRangeException("versionRequiredToExtract");
     }
     this.DateTime         = System.DateTime.Now;
     this.name             = CleanName(name);
     this.versionMadeBy    = (ushort)madeByInfo;
     this.versionToExtract = (ushort)versionRequiredToExtract;
     this.method           = method;
 }
Exemple #6
0
        private void ProcessAESExtraData(ZipExtraData extraData)
        {
            if (!extraData.Find(0x9901))
            {
                throw new ZipException("AES Extra Data missing");
            }
            this.versionToExtract = 0x33;
            this.Flags           |= 0x40;
            int valueLength = extraData.ValueLength;

            if (valueLength < 7)
            {
                throw new ZipException("AES Extra Data Length " + valueLength + " invalid.");
            }
            int num2 = extraData.ReadShort();
            int num3 = extraData.ReadShort();
            int num4 = extraData.ReadByte();
            int num5 = extraData.ReadShort();

            this._aesVer = num2;
            this._aesEncryptionStrength = num4;
            this.method = (ICSharpCode.SharpZipLib.Zip.CompressionMethod)num5;
        }
Exemple #7
0
 internal ZipEntry(string name, int versionRequiredToExtract, int madeByInfo, ICSharpCode.SharpZipLib.Zip.CompressionMethod method)
 {
     this.externalFileAttributes = -1;
     this.method = ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated;
     this.zipFileIndex = -1L;
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (name.Length > 0xffff)
     {
         throw new ArgumentException("Name is too long", "name");
     }
     if ((versionRequiredToExtract != 0) && (versionRequiredToExtract < 10))
     {
         throw new ArgumentOutOfRangeException("versionRequiredToExtract");
     }
     this.DateTime = System.DateTime.Now;
     this.name = CleanName(name);
     this.versionMadeBy = (ushort) madeByInfo;
     this.versionToExtract = (ushort) versionRequiredToExtract;
     this.method = method;
 }
Exemple #8
0

        
Exemple #9
0
 public static bool IsCompressionMethodSupported(ICSharpCode.SharpZipLib.Zip.CompressionMethod method) =>
 ((method == ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated) || (method == ICSharpCode.SharpZipLib.Zip.CompressionMethod.Stored));
Exemple #10
0
 private void ProcessAESExtraData(ZipExtraData extraData)
 {
     if (!extraData.Find(0x9901))
     {
         throw new ZipException("AES Extra Data missing");
     }
     this.versionToExtract = 0x33;
     this.Flags |= 0x40;
     int valueLength = extraData.ValueLength;
     if (valueLength < 7)
     {
         throw new ZipException("AES Extra Data Length " + valueLength + " invalid.");
     }
     int num2 = extraData.ReadShort();
     extraData.ReadShort();
     int num3 = extraData.ReadByte();
     int num4 = extraData.ReadShort();
     this._aesVer = num2;
     this._aesEncryptionStrength = num3;
     this.method = (ICSharpCode.SharpZipLib.Zip.CompressionMethod) num4;
 }