예제 #1
0
 /// <summary>
 /// reset the settings to the state they have on disk, useful for process that does not write settings but needs current version
 /// </summary>
 /// <param name="since"></param>
 /// <returns></returns>
 public bool SynchronizeSettings(DateTime?since)
 {
     try
     {
         if (since.HasValue)
         {
             if (File.GetLastWriteTime(_settingsFile) < since.Value)
             {
                 return(false);
             }
         }
         _settings = LoadSettingsFile();
         Synchronized?.Invoke(this, EventArgs.Empty);
         return(true);
     }
     catch (System.Exception ex)
     {
         Logger.Error(ex, $"the settings file '{_settingsFile}' has become corrupted; writing new file from settings we have in memory");
         SaveSettings();
         return(false);
     }
 }
예제 #2
0
 public void TriggerSynchronized()
 {
     Synchronized?.Invoke(this, EventArgs.Empty);
 }