Ejemplo n.º 1
0
        private CatalogFileRecord(byte[] bytes, int offset, string volumeName, string fileName)
        {
            VolumeName          = volumeName;
            FileName            = fileName;
            KeyLength           = Helper.SwapEndianness(BitConverter.ToUInt16(bytes, offset));
            ParentCatalogNodeId = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, offset + 0x02));
            Name = GetHfsString(bytes, offset + 0x06);

            int dataOffset = offset + KeyLength + 0x02;

            RecordType       = (RECORD_TYPE)Helper.SwapEndianness(BitConverter.ToUInt16(bytes, dataOffset));
            Flags            = (FILE_FLAGS)Helper.SwapEndianness(BitConverter.ToUInt16(bytes, dataOffset + 0x02));
            CatalogNodeId    = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x08));
            CreateDate       = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x0C)));
            ContentModDate   = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x10)));
            AttributeModDate = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x14)));
            AccessDate       = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x18)));
            BackupDate       = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x1C)));
            Permissions      = BSDInfo.Get(bytes, dataOffset + 0x20);
            UserInfo         = FileInfo.Get(bytes, dataOffset + 0x30);
            FinderInfo       = ExtendedFileInfo.Get(bytes, dataOffset + 0x40);
            TextEncoding     = (CatalogFile.TEXT_ENCODING)Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x50));

            VolumeHeader volHeader = VolumeHeader.Get(volumeName);

            DataFork     = ForkData.Get(bytes, dataOffset + 0x58, volumeName, volHeader.BlockSize);
            ResourceFork = ForkData.Get(bytes, dataOffset + 0xA8, volumeName, volHeader.BlockSize);
        }
Ejemplo n.º 2
0
        private CatalogFolderRecord(byte[] bytes, int offset, string volumeName, string fileName)
        {
            VolumeName          = volumeName;
            FileName            = fileName;
            KeyLength           = Helper.SwapEndianness(BitConverter.ToUInt16(bytes, offset));
            ParentCatalogNodeId = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, offset + 0x02));
            Name = GetHfsString(bytes, offset + 0x06);

            int dataOffset = offset + KeyLength + 0x02;

            RecordType       = (RECORD_TYPE)Helper.SwapEndianness(BitConverter.ToUInt16(bytes, dataOffset));
            Flags            = Helper.SwapEndianness(BitConverter.ToUInt16(bytes, dataOffset + 0x02));
            Valence          = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x04));
            CatalogNodeId    = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x08));
            CreateDate       = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x0C)));
            ContentModDate   = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x10)));
            AttributeModDate = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x14)));
            AccessDate       = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x18)));
            BackupDate       = Helper.FromOSXTime(Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x1C)));
            Permissions      = BSDInfo.Get(bytes, dataOffset + 0x20);
            UserInfo         = FolderInfo.Get(bytes, dataOffset + 0x30);
            FinderInfo       = ExtendedFolderInfo.Get(bytes, dataOffset + 0x40);
            TextEncoding     = (CatalogFile.TEXT_ENCODING)Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x50));
            FolderCount      = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, dataOffset + 0x54));
        }