From b76427890dedd0c23ecad7603093edf72564a944 Mon Sep 17 00:00:00 2001 From: coldino <28345893+coldino@users.noreply.github.com> Date: Thu, 1 Apr 2021 20:29:45 +0100 Subject: [PATCH] Beef up savefile change watching --- LarkatorGUI/MainWindow.xaml.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LarkatorGUI/MainWindow.xaml.cs b/LarkatorGUI/MainWindow.xaml.cs index d2041ac..34f15df 100644 --- a/LarkatorGUI/MainWindow.xaml.cs +++ b/LarkatorGUI/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using FastMember; +using FastMember; using GongSolutions.Wpf.DragDrop; @@ -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; @@ -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(() => {