Skip to content

Commit

Permalink
Changes to NotifyFilters
Browse files Browse the repository at this point in the history
  • Loading branch information
madskristensen committed Feb 22, 2016
1 parent 44e3a03 commit ae8510b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/BrowserLink/ReloadExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public ReloadExtension(Project project)
Watcher = new FileSystemWatcher(folder);
Watcher.Changed += FileChanged;
Watcher.IncludeSubdirectories = true;
Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.CreationTime;
Watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
Watcher.EnableRaisingEvents = VSPackage.Options.EnableReload;

VSPackage.Options.Saved += OptionsSaved;
Expand Down Expand Up @@ -66,6 +66,9 @@ public void Dispose()

async void FileChanged(object sender, FileSystemEventArgs e)
{
if (e.ChangeType != WatcherChangeTypes.Changed)
return;

string file = e.FullPath.ToLowerInvariant();
string ext = Path.GetExtension(file).TrimStart('.');

Expand All @@ -77,8 +80,10 @@ async void FileChanged(object sender, FileSystemEventArgs e)

var watcher = (FileSystemWatcher)sender;
watcher.EnableRaisingEvents = false;

await Task.Delay(VSPackage.Options.Delay);
Reload(ext);

watcher.EnableRaisingEvents = true;
}
}
Expand Down

0 comments on commit ae8510b

Please sign in to comment.