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); }
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); } } }
internal Zip64ExtraField(FileHeaderInfoBase headerInfo) { this.headerInfo = headerInfo; }