示例#1
0
        private static ExtraFieldBase GetExtraField(
            FileHeaderInfoBase headerInfo,
            BinaryReader reader)
        {
            ushort         num1           = reader.ReadUInt16();
            ExtraFieldType extraFieldType = ExtraFieldBase.GetExtraFieldType(num1);
            ushort         num2           = reader.ReadUInt16();

            byte[]         extraData = reader.ReadBytes((int)num2);
            ExtraFieldBase extraFieldBase;

            switch (extraFieldType)
            {
            case ExtraFieldType.Zip64:
                extraFieldBase = (ExtraFieldBase) new Zip64ExtraField(headerInfo);
                break;

            case ExtraFieldType.AesEncryption:
                extraFieldBase = (ExtraFieldBase) new AesEncryptionExtraField();
                break;

            default:
                extraFieldBase = (ExtraFieldBase) new UnknownExtraField(num1);
                break;
            }
            extraFieldBase.ParseBlock(extraData);
            return(extraFieldBase);
        }
示例#2
0
        public static IEnumerable <ExtraFieldBase> GetExtraFields(
            FileHeaderInfoBase headerInfo)
        {
            MemoryStream stream = new MemoryStream(headerInfo.ExtraFieldsData);

            using (BinaryReader reader = new BinaryReader((Stream)stream))
            {
                while (stream.Position < stream.Length)
                {
                    ExtraFieldBase field = ExtraFieldBase.GetExtraField(headerInfo, reader);
                    yield return(field);
                }
            }
        }
示例#3
0
 internal Zip64ExtraField(FileHeaderInfoBase headerInfo)
 {
     this.headerInfo = headerInfo;
 }