public InternalFileSystem(SynchronizationContext synchronizationContext, string fileName, VirtualDriveParameters parameters) { if (string.IsNullOrWhiteSpace(fileName)) { throw new ArgumentNullException(nameof(fileName)); } _synchronizationContext = synchronizationContext; _directoryWatcherSource = new VirtualDirectoryWatcherSource(_synchronizationContext); _rawDataManager = RawDataManager.Create(fileName, parameters ?? throw new ArgumentNullException(nameof(parameters))); try { var entries = _rawDataManager.ReadEntries(); Indexer.Populate(entries); } catch (Exception e) { _rawDataManager.Dispose(); throw new Exception("FS initialization failed", e); } }
public void Dispose() { _directoryWatcherSource?.Dispose(); _rawDataManager?.Dispose(); }