public IChangeToken Watch(string filter) { if (filter.IndexOf('*') >= 0) { throw new ArgumentException($"Wildcards are not allowed", nameof(filter)); } var filePath = Path.Combine(_root, filter); lock (_gate) { if (_changeTokens == null) { _changeTokens = new Dictionary <string, PollingFileChangeToken>(StringComparer.OrdinalIgnoreCase); } if (!_changeTokens.TryGetValue(filePath, out var changeToken)) { changeToken = new PollingFileChangeToken(filePath); _changeTokens.Add(filePath, changeToken); } return(changeToken); } }
public DisposableChangeCallback(PollingFileChangeToken pollingFileChangeToken, int callbackId) { _changeToken = pollingFileChangeToken; _callbackId = callbackId; }