void end() { if (_watcher_ == null) { _exception_ = null; return; } Debug.Assert(_exception_ == null); _watcher_.Dispose(); _watcher_ = null; }
void tryBegin() { end(); Debug.Assert(_watcher_ == null && _exception_ == null); try { _watcher_ = new FileWatcher(_directory, _filter); _watcher_.Changed += () => Changed.raise(); _watcher_.Error += error; } catch (Exception e) { _exception_ = e; } }