Пример #1
0
        private void AddLeafDirExtentEntries(IList <Extent> extents, Dictionary <string, DirEntry> target)
        {
            var leafOffset = LeafDirectory.LeafOffset / Context.SuperBlock.Blocksize;

            foreach (var extent in extents)
            {
                if (extent.StartOffset < leafOffset)
                {
                    for (long i = 0; i < extent.BlockCount; i++)
                    {
                        var buffer  = extent.GetData(Context, i * Context.SuperBlock.DirBlockSize, Context.SuperBlock.DirBlockSize);
                        var leafDir = new LeafDirectory(Context);
                        if (Context.SuperBlock.SbVersion == 5)
                        {
                            leafDir = new LeafDirectoryV5(Context);
                        }
                        leafDir.ReadFrom(buffer, 0);
                        if (!leafDir.HasValidMagic)
                        {
                            throw new IOException("invalid leaf directory magic");
                        }
                        AddDirEntries(leafDir.Entries, target);
                    }
                }
            }
        }
Пример #2
0
        private void AddLeafDirExtentEntries(IList <Extent> extents, Dictionary <string, DirEntry> target)
        {
            var leafOffset = LeafDirectory.LeafOffset / Context.SuperBlock.Blocksize;

            foreach (var extent in extents)
            {
                if (extent.StartOffset < leafOffset)
                {
                    var leafDir = new LeafDirectory();
                    var buffer  = extent.GetData(Context, Context.SuperBlock.DirBlockSize);
                    leafDir.ReadFrom(buffer, 0);
                    if (leafDir.Magic != LeafDirectory.HeaderMagic)
                    {
                        throw new IOException("invalid leaf directory magic");
                    }
                    AddDirEntries(leafDir.Entries, target);
                }
            }
        }