Пример #1
0
        public static Zip64ExtraField GetJustZip64Block(Stream extraFieldStream, bool readUncompressedSize, bool readCompressedSize, bool readLocalHeaderOffset, bool readStartDiskNumber)
        {
            using (BinaryReader reader = new BinaryReader(extraFieldStream))
            {
                ZipGenericExtraField field;

                while (ZipGenericExtraField.TryReadBlock(reader, extraFieldStream.Length, out field))
                {
                    Zip64ExtraField zip64Block;

                    if (Zip64ExtraField.TryGetZip64BlockFromGenericExtraField(field, readUncompressedSize, readCompressedSize, readLocalHeaderOffset, readStartDiskNumber, out zip64Block))
                    {
                        return(zip64Block);
                    }
                }
            }

            return(new Zip64ExtraField()
            {
                _compressedSize = new long?(),
                _uncompressedSize = new long?(),
                _localHeaderOffset = new long?(),
                _startDiskNumber = new int?()
            });
        }
        public static List <ZipGenericExtraField> ParseExtraField(Stream extraFieldData)
        {
            List <ZipGenericExtraField> list = new List <ZipGenericExtraField>();

            using (BinaryReader reader = new BinaryReader(extraFieldData))
            {
                ZipGenericExtraField field;

                while (ZipGenericExtraField.TryReadBlock(reader, extraFieldData.Length, out field))
                {
                    list.Add(field);
                }
            }

            return(list);
        }