Example #1
0
        public HostsWatcher(IHostsParser parser, string path)
        {
            this.parser = parser;
            this.path = path;

            var directoryName = Path.GetDirectoryName(path);
            var fileName = Path.GetFileName(path);

            this.watcher = new FileSystemWatcher(directoryName, fileName);
            watcher.NotifyFilter = NotifyFilters.LastWrite;

            this.watcher.Changed += this.WatcherChanged;

            watcher.EnableRaisingEvents = true;
        }
Example #2
0
        public HostsWatcher(IHostsParser parser, string path)
        {
            this.parser = parser;
            this.path   = path;

            var directoryName = Path.GetDirectoryName(path);
            var fileName      = Path.GetFileName(path);

            this.watcher         = new FileSystemWatcher(directoryName, fileName);
            watcher.NotifyFilter = NotifyFilters.LastWrite;

            this.watcher.Changed += this.WatcherChanged;

            watcher.EnableRaisingEvents = true;
        }