private void OnChangedLocationData(object source, FileSystemEventArgs e) { if (!AdmConfigBuilder.IsFileLocked(new FileInfo(configBuilder.LocationDataPath))) { try { configBuilder.LoadLocationData(); Logger.Debug("updated location data file"); } catch (Exception ex) { Logger.Debug(ex, "location data file locked, cannot load"); } } }
private void OnChangedConfig(object source, FileSystemEventArgs e) { if (!AdmConfigBuilder.IsFileLocked(new FileInfo(configBuilder.ConfigFilePath))) { try { configBuilder.Load(); if (warden != null) { warden.Fire(); } Logger.Debug("updated configuration file"); } catch (Exception ex) { Logger.Debug(ex, "config file locked, cannot load"); } } }
private void OnChangedLocationData(object source, FileSystemEventArgs e) { if (DateTime.Now.Subtract(lastTimeLocationConfigChanged).TotalMilliseconds < 20) { return; } lastTimeLocationConfigChanged = DateTime.Now; if (!AdmConfigBuilder.IsFileLocked(new FileInfo(builder.LocationDataPath))) { try { builder.LoadLocationData(); Logger.Debug("updated location data file"); } catch (Exception ex) { Logger.Debug(ex, "location data file locked, cannot load"); } } }