Skip to content

Commit

Permalink
Beef up savefile change watching
Browse files Browse the repository at this point in the history
  • Loading branch information
coldino committed Apr 3, 2021
1 parent 49316bf commit 0d9a47b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FastMember;
using FastMember;

using GongSolutions.Wpf.DragDrop;

Expand Down Expand Up @@ -240,8 +240,10 @@ private void SetupFileWatcher()
if (fileWatcher != null)
fileWatcher.EnableRaisingEvents = false;
fileWatcher = new FileSystemWatcher(Path.GetDirectoryName(Properties.Settings.Default.SaveFile));
fileWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.CreationTime;
fileWatcher.Renamed += FileWatcher_Changed;
fileWatcher.Changed += FileWatcher_Changed;
fileWatcher.Created += FileWatcher_Changed;
fileWatcher.EnableRaisingEvents = true;
reloadTimer.Interval = TimeSpan.FromMilliseconds(Properties.Settings.Default.ConvertDelay);
reloadTimer.Tick += ReloadTimer_Tick;
Expand Down Expand Up @@ -294,7 +296,7 @@ private void ValidateWindowPositionAndSize()

private void FileWatcher_Changed(object sender, FileSystemEventArgs e)
{
if (!String.Equals(e.FullPath, Properties.Settings.Default.SaveFile))
if (e.FullPath?.ToLowerInvariant() != Properties.Settings.Default.SaveFile?.ToLowerInvariant())
return;

Dispatcher.Invoke(() => {
Expand Down

0 comments on commit 0d9a47b

Please sign in to comment.