Example #1
0
 public File(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo catalogInfo)
 {
     _context                 = context;
     _nodeId                  = nodeId;
     _catalogInfo             = catalogInfo;
     _hasCompressionAttribute = this._context.Attributes.Find(new AttributeKey(this._nodeId, CompressionAttributeName)) != null;
 }
Example #2
0
 public File(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo catalogInfo)
 {
     _context = context;
     _nodeId = nodeId;
     _catalogInfo = catalogInfo;
     _hasCompressionAttribute = this._context.Attributes.Find(new AttributeKey(this._nodeId, CompressionAttributeName)) != null;
 }
 public ExtentKey(CatalogNodeId cnid, uint startBlock, bool resource_fork = false)
 {
     _keyLength  = 10;
     _nodeId     = cnid;
     _startBlock = startBlock;
     _forkType   = (byte)(resource_fork ? 0xff : 0x00);
 }
Example #4
0
        public int ReadFrom(byte[] buffer, int offset)
        {
            RecordType = (CatalogRecordType)Utilities.ToInt16BigEndian(buffer, offset + 0);
            ParentId   = Utilities.ToUInt32BigEndian(buffer, offset + 4);
            Name       = HfsPlusUtilities.ReadUniStr255(buffer, offset + 8);

            return(0);
        }
Example #5
0
        public int ReadFrom(byte[] buffer, int offset)
        {
            RecordType = (CatalogRecordType)Utilities.ToInt16BigEndian(buffer, offset + 0);
            ParentId = Utilities.ToUInt32BigEndian(buffer, offset + 4);
            Name = HfsPlusUtilities.ReadUniStr255(buffer, offset + 8);

            return 0;
        }
 public override int ReadFrom(byte[] buffer, int offset)
 {
     _keyLength  = Utilities.ToUInt16BigEndian(buffer, offset + 0);
     _forkType   = buffer[offset + 2];
     _nodeId     = new CatalogNodeId(Utilities.ToUInt32BigEndian(buffer, offset + 4));
     _startBlock = Utilities.ToUInt32BigEndian(buffer, offset + 8);
     return(_keyLength + 2);
 }
Example #7
0
        public override int ReadFrom(byte[] buffer, int offset)
        {
            _keyLength = EndianUtilities.ToUInt16BigEndian(buffer, offset + 0);
            NodeId     = new CatalogNodeId(EndianUtilities.ToUInt32BigEndian(buffer, offset + 2));
            Name       = HfsPlusUtilities.ReadUniStr255(buffer, offset + 6);

            return(_keyLength + 2);
        }
Example #8
0
 public HfsPlusFile(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo catalogInfo)
 {
     this.Context                 = context;
     this.NodeId                  = nodeId;
     this.catalogInfo             = catalogInfo;
     this.hasCompressionAttribute =
         this.Context.Attributes?.Find(new AttributeKey(this.NodeId, CompressionAttributeName)) != null;
 }
Example #9
0
        public override int ReadFrom(byte[] buffer, int offset)
        {
            _keyLength  = Utilities.ToUInt16BigEndian(buffer, offset + 0);
            _pad        = Utilities.ToUInt16BigEndian(buffer, offset + 2);
            _fileId     = new CatalogNodeId(Utilities.ToUInt32BigEndian(buffer, offset + 4));
            _startBlock = Utilities.ToUInt32BigEndian(buffer, offset + 8);
            _name       = HfsPlusUtilities.ReadUniStr255(buffer, offset + 12);

            return(_keyLength + 2);
        }
        public virtual int ReadFrom(byte[] buffer, int offset)
        {
            RecordType = (CatalogRecordType)Utilities.ToInt16BigEndian(buffer, offset + 0);
            FileId = Utilities.ToUInt32BigEndian(buffer, offset + 8);
            CreateTime = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 12);
            ContentModifyTime = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 16);
            AttributeModifyTime = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 20);
            AccessTime = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 24);
            BackupTime = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 28);

            uint special;
            FileSystemInfo = HfsPlusUtilities.ReadBsdInfo(buffer, offset + 32, out special);
            UnixSpecialField = special;

            return 0;
        }
Example #11
0
        public int ReadFrom(byte[] buffer, int offset)
        {
            Signature = EndianUtilities.ToUInt16BigEndian(buffer, offset + 0);
            if (!IsValid)
            {
                return(Size);
            }

            Version            = EndianUtilities.ToUInt16BigEndian(buffer, offset + 2);
            Attributes         = (VolumeAttributes)EndianUtilities.ToUInt32BigEndian(buffer, offset + 4);
            LastMountedVersion = EndianUtilities.ToUInt32BigEndian(buffer, offset + 8);
            JournalInfoBlock   = EndianUtilities.ToUInt32BigEndian(buffer, offset + 12);

            CreateDate  = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Local, buffer, offset + 16);
            ModifyDate  = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 20);
            BackupDate  = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 24);
            CheckedDate = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 28);

            FileCount   = EndianUtilities.ToUInt32BigEndian(buffer, offset + 32);
            FolderCount = EndianUtilities.ToUInt32BigEndian(buffer, offset + 36);

            BlockSize   = EndianUtilities.ToUInt32BigEndian(buffer, offset + 40);
            TotalBlocks = EndianUtilities.ToUInt32BigEndian(buffer, offset + 44);
            FreeBlocks  = EndianUtilities.ToUInt32BigEndian(buffer, offset + 48);

            NextAllocation    = EndianUtilities.ToUInt32BigEndian(buffer, offset + 52);
            ResourceClumpSize = EndianUtilities.ToUInt32BigEndian(buffer, offset + 56);
            DataClumpSize     = EndianUtilities.ToUInt32BigEndian(buffer, offset + 60);
            NextCatalogId     = new CatalogNodeId(EndianUtilities.ToUInt32BigEndian(buffer, offset + 64));

            WriteCount      = EndianUtilities.ToUInt32BigEndian(buffer, offset + 68);
            EncodingsBitmap = EndianUtilities.ToUInt64BigEndian(buffer, offset + 72);

            FinderInfo = new uint[8];
            for (int i = 0; i < 8; ++i)
            {
                FinderInfo[i] = EndianUtilities.ToUInt32BigEndian(buffer, offset + 80 + i * 4);
            }

            AllocationFile = EndianUtilities.ToStruct <ForkData>(buffer, offset + 112);
            ExtentsFile    = EndianUtilities.ToStruct <ForkData>(buffer, offset + 192);
            CatalogFile    = EndianUtilities.ToStruct <ForkData>(buffer, offset + 272);
            AttributesFile = EndianUtilities.ToStruct <ForkData>(buffer, offset + 352);
            StartupFile    = EndianUtilities.ToStruct <ForkData>(buffer, offset + 432);

            return(512);
        }
        public virtual int ReadFrom(byte[] buffer, int offset)
        {
            RecordType          = (CatalogRecordType)EndianUtilities.ToInt16BigEndian(buffer, offset + 0);
            FileId              = EndianUtilities.ToUInt32BigEndian(buffer, offset + 8);
            CreateTime          = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 12);
            ContentModifyTime   = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 16);
            AttributeModifyTime = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 20);
            AccessTime          = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 24);
            BackupTime          = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 28);

            uint special;

            FileSystemInfo   = HfsPlusUtilities.ReadBsdInfo(buffer, offset + 32, out special);
            UnixSpecialField = special;

            return(0);
        }
Example #13
0
 public Symlink(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo catalogInfo)
     : base(context, nodeId, catalogInfo)
 {
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileBuffer"/> class.
 /// </summary>
 /// <param name="context">
 /// The global HFS+ context.
 /// </param>
 /// <param name="baseData">
 /// The <see cref="ForkData"/> structure which represents the base file data.
 /// </param>
 /// <param name="catalogNodeId">
 /// The <see cref="CatalogNodeId"/> which uniquely identifies the file.
 /// </param>
 public FileBuffer(Context context, ForkData baseData, CatalogNodeId catalogNodeId)
 {
     this.context  = context;
     this.baseData = baseData;
     this.cnid     = catalogNodeId;
 }
Example #15
0
 public AttributeKey(CatalogNodeId nodeId, string name)
 {
     _fileId = nodeId;
     _name   = name;
 }
 public Directory(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo fileInfo)
     : base(context, nodeId, fileInfo)
 {
 }
Example #17
0
 public AttributeKey(CatalogNodeId nodeId, string name)
 {
     this.FileId = nodeId;
     this.Name   = name;
 }
Example #18
0
 public File(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo catalogInfo)
 {
     _context     = context;
     _nodeId      = nodeId;
     _catalogInfo = catalogInfo;
 }
Example #19
0
        public int ReadFrom(byte[] buffer, int offset)
        {
            Signature = Utilities.ToUInt16BigEndian(buffer, offset + 0);
            Version = Utilities.ToUInt16BigEndian(buffer, offset + 2);
            Attributes = (VolumeAttributes)Utilities.ToUInt32BigEndian(buffer, offset + 4);
            LastMountedVersion = Utilities.ToUInt32BigEndian(buffer, offset + 8);
            JournalInfoBlock = Utilities.ToUInt32BigEndian(buffer, offset + 12);

            CreateDate = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Local, buffer, offset + 16);
            ModifyDate = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 20);
            BackupDate = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 24);
            CheckedDate = HfsPlusUtilities.ReadHFSPlusDate(DateTimeKind.Utc, buffer, offset + 28);

            FileCount = Utilities.ToUInt32BigEndian(buffer, offset + 32);
            FolderCount = Utilities.ToUInt32BigEndian(buffer, offset + 36);

            BlockSize = Utilities.ToUInt32BigEndian(buffer, offset + 40);
            TotalBlocks = Utilities.ToUInt32BigEndian(buffer, offset + 44);
            FreeBlocks = Utilities.ToUInt32BigEndian(buffer, offset + 48);

            NextAllocation = Utilities.ToUInt32BigEndian(buffer, offset + 52);
            ResourceClumpSize = Utilities.ToUInt32BigEndian(buffer, offset + 56);
            DataClumpSize = Utilities.ToUInt32BigEndian(buffer, offset + 60);
            NextCatalogId = new CatalogNodeId(Utilities.ToUInt32BigEndian(buffer, offset + 64));

            WriteCount = Utilities.ToUInt32BigEndian(buffer, offset + 68);
            EncodingsBitmap = Utilities.ToUInt64BigEndian(buffer, offset + 72);

            FinderInfo = new uint[8];
            for (int i = 0; i < 8; ++i)
            {
                FinderInfo[i] = Utilities.ToUInt32BigEndian(buffer, offset + 80 + (i * 4));
            }

            AllocationFile = (ForkData)Utilities.ToStruct<ForkData>(buffer, offset + 112);
            ExtentsFile = (ForkData)Utilities.ToStruct<ForkData>(buffer, offset + 192);
            CatalogFile = (ForkData)Utilities.ToStruct<ForkData>(buffer, offset + 272);
            AttributesFile = (ForkData)Utilities.ToStruct<ForkData>(buffer, offset + 352);
            StartupFile = (ForkData)Utilities.ToStruct<ForkData>(buffer, offset + 432);

            return 512;
        }
Example #20
0
 public FileBuffer(Context context, ForkData baseData, CatalogNodeId catalogNodeId)
 {
     _context = context;
     _baseData = baseData;
     _cnid = catalogNodeId;
 }
 public FileBuffer(Context context, ForkData baseData, CatalogNodeId catalogNodeId)
 {
     _context  = context;
     _baseData = baseData;
     _cnid     = catalogNodeId;
 }
Example #22
0
        public override int ReadFrom(byte[] buffer, int offset)
        {
            _keyLength = Utilities.ToUInt16BigEndian(buffer, offset + 0);
            _pad = Utilities.ToUInt16BigEndian(buffer, offset + 2);
            _fileId = new CatalogNodeId(Utilities.ToUInt32BigEndian(buffer, offset + 4));
            _startBlock = Utilities.ToUInt32BigEndian(buffer, offset + 8);
            _name = HfsPlusUtilities.ReadUniStr255(buffer, offset + 12);

            return _keyLength + 2;
        }
Example #23
0
 public AttributeKey(CatalogNodeId nodeId, string name)
 {
     _fileId = nodeId;
     _name = name;
 }
Example #24
0
 public CatalogKey(CatalogNodeId nodeId, string name)
 {
     this.NodeId    = nodeId;
     this.Name      = name;
     this.keyLength = (ushort)(2 /* keyLength */ + 4 /*nodeId */ + Encoding.BigEndianUnicode.GetByteCount(this.Name));
 }
Example #25
0
 public File(Context context, CatalogNodeId nodeId, CommonCatalogFileInfo catalogInfo)
 {
     _context = context;
     _nodeId = nodeId;
     _catalogInfo = catalogInfo;
 }
Example #26
0
 public CatalogKey(CatalogNodeId nodeId, string name)
 {
     NodeId = nodeId;
     Name   = name;
 }