Add option to disable config reloading

This commit is contained in:
jvyden 2022-01-20 14:43:26 -05:00
commit 23eaed40b7
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -69,17 +69,20 @@ public class ServerSettings
}
// Set up reloading
Logger.Log("Setting up config reloading...", LoggerLevelConfig.Instance);
fileWatcher = new FileSystemWatcher
if (Instance.ConfigReloading)
{
Path = Environment.CurrentDirectory,
Filter = ConfigFileName,
NotifyFilter = NotifyFilters.LastWrite, // only watch for writes to config file
};
Logger.Log("Setting up config reloading...", LoggerLevelConfig.Instance);
fileWatcher = new FileSystemWatcher
{
Path = Environment.CurrentDirectory,
Filter = ConfigFileName,
NotifyFilter = NotifyFilters.LastWrite, // only watch for writes to config file
};
fileWatcher.Changed += onConfigChanged; // add event handler
fileWatcher.Changed += onConfigChanged; // add event handler
fileWatcher.EnableRaisingEvents = true; // begin watching
fileWatcher.EnableRaisingEvents = true; // begin watching
}
}
private static void onConfigChanged(object sender, FileSystemEventArgs e)
@ -140,6 +143,8 @@ public class ServerSettings
public bool VitaCreateMode { get; set; }
public bool ConfigReloading { get; set; } = true;
#region Meta
[NotNull]