Example #1
0
        public byte[] this[byte[] key]
        {
            get
            {
                byte[] value;
                if (TryGetValue(key, out value))
                {
                    return(value);
                }
                throw new KeyNotFoundException();
            }

            set
            {
                IndexEntry oldEntry;
                IndexNode  node;
                _rootNode.TotalSpaceAvailable = _rootNode.CalcSize() +
                                                _file.MftRecordFreeSpace(AttributeType.IndexRoot, _name);
                if (_rootNode.TryFindEntry(key, out oldEntry, out node))
                {
                    node.UpdateEntry(key, value);
                }
                else
                {
                    _rootNode.AddEntry(key, value);
                }
            }
        }
Example #2
0
        internal bool ShrinkRoot()
        {
            if (_rootNode.Depose())
            {
                WriteRootNodeToDisk();
                _rootNode.TotalSpaceAvailable = _rootNode.CalcSize() + _file.MftRecordFreeSpace(AttributeType.IndexRoot, _name);
                return(true);
            }

            return(false);
        }