Example #1
0
        public HFSDirectory(BinaryReader reader)
        {
            if (reader.ReadInt32() != HFSFile.HFHeader)
            {
                throw new HFSException(HFSError.HFSDirectoryMismatch);
            }

            Version           = reader.ReadInt16();
            ExtractVersion    = reader.ReadInt16();
            BitFlag           = reader.ReadInt16();
            CompressionMethod = (HFSCompressionMethod)reader.ReadInt16();
            Contract.Assert(CompressionMethod == HFSCompressionMethod.Store, "CompressionMethod == Store");
            ModFileTime      = reader.ReadInt16();
            ModFileDate      = reader.ReadInt16();
            Checksum         = reader.ReadInt32();
            CompressedSize   = reader.ReadInt32();
            DecompressedSize = reader.ReadInt32();
            var filenameLength = reader.ReadInt16();
            var extraLength    = reader.ReadInt16();
            var commentLength  = reader.ReadInt16();

            PartitionNumber    = reader.ReadInt16();
            InternalAttributes = reader.ReadInt16();
            Attributes         = reader.ReadInt32();
            DataOffset         = reader.ReadInt32();
            var position = (int)reader.BaseStream.Position;

            Filename = HFS.XorStringWithKey(reader.ReadBytes(filenameLength), HFSXorTruths.KeyTable, position);
            position = (int)reader.BaseStream.Position;
            Extra    = HFS.XorStringWithKey(reader.ReadBytes(extraLength), HFSXorTruths.KeyTable, position);
            position = (int)reader.BaseStream.Position;
            Comment  = HFS.XorStringWithKey(reader.ReadBytes(commentLength), HFSXorTruths.KeyTable, position);
            position = (int)reader.BaseStream.Position;
            reader.BaseStream.Position = DataOffset;
            File = new HFSFile(reader);
            reader.BaseStream.Position = position;
        }
Example #2
0
 public HFSDirectory(HFSFile file)
 {
     File = file;
 }