public void EnumChildren(EnumChildrenDelegate callback) { MfsCellId cellId; MfsObjectHeader *obj; cellId = _obj->ChildFlink; // Traverse the linked list. while (true) { MfsCellId newCellId; if (cellId == _cellId) { break; } obj = _fs.ReferenceObject(cellId); if (!callback(new MemoryObject(_fs, cellId))) { _fs.DereferenceObject(cellId); break; } newCellId = obj->Flink; _fs.DereferenceObject(cellId); cellId = newCellId; } }
internal MemoryObject(MemoryFileSystem fs, MfsCellId cellId, bool fsInternal) { _fs = fs; _cellId = cellId; _obj = _fs.ReferenceObject(cellId); _fsInternal = fsInternal; if (!_fsInternal) _fs.Reference(); // Prevent users from disposing the root object wrapper. if (_fsInternal) this.DisableOwnership(false); }
internal MemoryObject(MemoryFileSystem fs, MfsCellId cellId, bool fsInternal) { _fs = fs; _cellId = cellId; _obj = _fs.ReferenceObject(cellId); _fsInternal = fsInternal; if (!_fsInternal) { _fs.Reference(); } // Prevent users from disposing the root object wrapper. if (_fsInternal) { this.DisableOwnership(false); } }