Esempio n. 1
0
 internal ExtentKey(byte[] bytes)
 {
     KeyLength  = BitConverter.ToUInt16(bytes, 0x00);
     ForkType   = bytes[0x02];
     pad        = bytes[0x03];
     FileId     = (CatalogNodeId.CATALOG_ID)BitConverter.ToUInt32(bytes, 0x04);
     StartBlock = BitConverter.ToUInt32(bytes, 0x08);
 }
Esempio n. 2
0
        internal VolumeHeader(byte[] bytes)
        {
            Signature = Encoding.ASCII.GetString(bytes, 0x00, 0x02);

            if (Signature == "H+")
            {
                Version            = BitConverter.ToUInt16(bytes, 0x02);
                Attributes         = BitConverter.ToUInt32(bytes, 0x04);
                LastMountedVersion = BitConverter.ToUInt32(bytes, 0x08);
                JournalInfoBlock   = BitConverter.ToUInt32(bytes, 0x0C);

                CreateDate  = BitConverter.ToUInt32(bytes, 0x10);
                ModifyDate  = BitConverter.ToUInt32(bytes, 0x14);
                BackupDate  = BitConverter.ToUInt32(bytes, 0x18);
                CheckedDate = BitConverter.ToUInt32(bytes, 0x1C);

                FileCount   = BitConverter.ToUInt32(bytes, 0x20);
                FolderCount = BitConverter.ToUInt32(bytes, 0x24);

                BlockSize   = BitConverter.ToUInt32(bytes, 0x28);
                TotalBlocks = BitConverter.ToUInt32(bytes, 0x2C);
                FreeBlocks  = BitConverter.ToUInt32(bytes, 0x30);

                NextAllocation = BitConverter.ToUInt32(bytes, 0x34);
                RsrcClumpSize  = BitConverter.ToUInt32(bytes, 0x38);
                DataClumpSize  = BitConverter.ToUInt32(bytes, 0x3C);
                NextCatalogId  = (CatalogNodeId.CATALOG_ID)BitConverter.ToUInt32(bytes, 0x40);

                WriteCount      = BitConverter.ToUInt32(bytes, 0x44);
                EncodingsBitmap = BitConverter.ToUInt64(bytes, 0x48);

                //FinderInfo = BitConverter.ToUInt32(bytes, 0x50);

                AllocationFile = new ForkData(NativeMethods.GetSubArray(bytes, 0x70, 0x50));
                ExtentsFile    = new ForkData(NativeMethods.GetSubArray(bytes, 0xC0, 0x50));
                CatalogFile    = new ForkData(NativeMethods.GetSubArray(bytes, 0x110, 0x50));
                AttributesFile = new ForkData(NativeMethods.GetSubArray(bytes, 0x160, 0x50));
                StartupFile    = new ForkData(NativeMethods.GetSubArray(bytes, 0x1B0, 0x50));
            }
            else
            {
                throw new Exception("Not a valid HFS+ volume");
            }
        }
        internal VolumeHeader(byte[] bytes)
        {
            Signature = Encoding.ASCII.GetString(bytes, 0x00, 0x02);

            if (Signature == "H+")
            {
                Version = BitConverter.ToUInt16(bytes, 0x02);
                Attributes = BitConverter.ToUInt32(bytes, 0x04);
                LastMountedVersion = BitConverter.ToUInt32(bytes, 0x08);
                JournalInfoBlock = BitConverter.ToUInt32(bytes, 0x0C);

                CreateDate = BitConverter.ToUInt32(bytes, 0x10);
                ModifyDate = BitConverter.ToUInt32(bytes, 0x14);
                BackupDate = BitConverter.ToUInt32(bytes, 0x18);
                CheckedDate = BitConverter.ToUInt32(bytes, 0x1C);

                FileCount = BitConverter.ToUInt32(bytes, 0x20);
                FolderCount = BitConverter.ToUInt32(bytes, 0x24);

                BlockSize = BitConverter.ToUInt32(bytes, 0x28);
                TotalBlocks = BitConverter.ToUInt32(bytes, 0x2C);
                FreeBlocks = BitConverter.ToUInt32(bytes, 0x30);

                NextAllocation = BitConverter.ToUInt32(bytes, 0x34);
                RsrcClumpSize = BitConverter.ToUInt32(bytes, 0x38);
                DataClumpSize = BitConverter.ToUInt32(bytes, 0x3C);
                NextCatalogId = (CatalogNodeId.CATALOG_ID)BitConverter.ToUInt32(bytes, 0x40);

                WriteCount = BitConverter.ToUInt32(bytes, 0x44);
                EncodingsBitmap = BitConverter.ToUInt64(bytes, 0x48);

                //FinderInfo = BitConverter.ToUInt32(bytes, 0x50);

                AllocationFile = new ForkData(NativeMethods.GetSubArray(bytes, 0x70, 0x50));
                ExtentsFile = new ForkData(NativeMethods.GetSubArray(bytes, 0xC0, 0x50));
                CatalogFile = new ForkData(NativeMethods.GetSubArray(bytes, 0x110, 0x50));
                AttributesFile = new ForkData(NativeMethods.GetSubArray(bytes, 0x160, 0x50));
                StartupFile = new ForkData(NativeMethods.GetSubArray(bytes, 0x1B0, 0x50));
            }
            else
            {
                throw new Exception("Not a valid HFS+ volume");
            }
        }