コード例 #1
0
        public HierarchicalIntegrityVerificationStorage(IntegrityVerificationInfo[] levelInfo, IntegrityCheckLevel integrityCheckLevel, bool leaveOpen)
        {
            Levels = new IStorage[levelInfo.Length];
            IntegrityCheckLevel = integrityCheckLevel;
            LevelValidities     = new Validity[levelInfo.Length - 1][];
            IntegrityStorages   = new IntegrityVerificationStorage[levelInfo.Length - 1];

            Levels[0] = levelInfo[0].Data;

            for (int i = 1; i < Levels.Length; i++)
            {
                var levelData = new IntegrityVerificationStorage(levelInfo[i], Levels[i - 1], integrityCheckLevel, leaveOpen);

                int cacheCount = Math.Min((int)Util.DivideByRoundUp(levelData.GetSize(), levelInfo[i].BlockSize), 4);

                Levels[i] = new CachedStorage(levelData, cacheCount, leaveOpen);
                LevelValidities[i - 1]   = levelData.BlockValidities;
                IntegrityStorages[i - 1] = levelData;
            }

            DataLevel = Levels[Levels.Length - 1];
            _length   = DataLevel.GetSize();

            if (!leaveOpen)
            {
                ToDispose.Add(DataLevel);
            }
        }
コード例 #2
0
        public HierarchicalIntegrityVerificationStorage(IntegrityVerificationInfo[] levelInfo, IntegrityCheckLevel integrityCheckLevel, bool leaveOpen)
        {
            Levels = new IStorage[levelInfo.Length];
            IntegrityCheckLevel = integrityCheckLevel;
            LevelValidities     = new Validity[levelInfo.Length - 1][];
            IntegrityStorages   = new IntegrityVerificationStorage[levelInfo.Length - 1];

            Levels[0] = levelInfo[0].Data;

            for (int i = 1; i < Levels.Length; i++)
            {
                var levelData = new IntegrityVerificationStorage(levelInfo[i], Levels[i - 1], integrityCheckLevel, leaveOpen);

                Levels[i] = new CachedStorage(levelData, 4, leaveOpen);
                LevelValidities[i - 1]   = levelData.BlockValidities;
                IntegrityStorages[i - 1] = levelData;
            }

            DataLevel = Levels[Levels.Length - 1];
            Length    = DataLevel.Length;

            if (!leaveOpen)
            {
                ToDispose.Add(DataLevel);
            }
        }