コード例 #1
0
        public HfsPlusFileSystemImpl(Stream s)
            : base(new DiscFileSystemOptions())
        {
            s.Position = 1024;

            byte[]       headerBuf = Utilities.ReadFully(s, 512);
            VolumeHeader hdr       = new VolumeHeader();

            hdr.ReadFrom(headerBuf, 0);

            Context = new HfsPlus.Context();
            Context.VolumeStream = s;
            Context.VolumeHeader = hdr;

            FileBuffer catalogBuffer = new FileBuffer(Context, hdr.CatalogFile, CatalogNodeId.CatalogFileId);

            Context.Catalog = new BTree <CatalogKey>(catalogBuffer);

            FileBuffer extentsBuffer = new FileBuffer(Context, hdr.ExtentsFile, CatalogNodeId.ExtentsFileId);

            Context.ExtentsOverflow = new BTree <ExtentKey>(extentsBuffer);

            // Establish Root directory
            byte[]        rootThreadData = Context.Catalog.Find(new CatalogKey(CatalogNodeId.RootFolderId, string.Empty));
            CatalogThread rootThread     = new CatalogThread();

            rootThread.ReadFrom(rootThreadData, 0);
            byte[]   rootDirEntryData = Context.Catalog.Find(new CatalogKey(rootThread.ParentId, rootThread.Name));
            DirEntry rootDirEntry     = new DirEntry(rootThread.Name, rootDirEntryData);

            RootDirectory = (Directory)GetFile(rootDirEntry);
        }
コード例 #2
0
        internal static bool Detect(Stream stream)
        {
            if (stream.Length < 1536)
            {
                return false;
            }

            stream.Position = 1024;

            byte[] headerBuf = Utilities.ReadFully(stream, 512);
            VolumeHeader hdr = new VolumeHeader();
            hdr.ReadFrom(headerBuf, 0);

            return hdr.IsValid;
        }
コード例 #3
0
        internal static bool Detect(Stream stream)
        {
            if (stream.Length < 1536)
            {
                return(false);
            }

            stream.Position = 1024;

            byte[]       headerBuf = Utilities.ReadFully(stream, 512);
            VolumeHeader hdr       = new VolumeHeader();

            hdr.ReadFrom(headerBuf, 0);

            return(hdr.IsValid);
        }