mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 15:17:23 +01:00
fix unnecessary config reload on save
This commit is contained in:
parent
4650893599
commit
6d1cfed0ba
3 changed files with 7 additions and 0 deletions
|
|
@ -113,6 +113,7 @@ public class ConfigurationSaveService : IHostedService
|
||||||
WriteIndented = true
|
WriteIndented = true
|
||||||
})).ConfigureAwait(false);
|
})).ConfigureAwait(false);
|
||||||
File.Move(temp, config.ConfigurationPath, true);
|
File.Move(temp, config.ConfigurationPath, true);
|
||||||
|
config.UpdateLastWriteTime();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ public abstract class ConfigurationServiceBase<T> : IConfigService<T> where T :
|
||||||
ConfigSave?.Invoke(this, EventArgs.Empty);
|
ConfigSave?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateLastWriteTime()
|
||||||
|
{
|
||||||
|
_configLastWriteTime = GetConfigLastWriteTime();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposing || _disposed) return;
|
if (!disposing || _disposed) return;
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,5 @@ public interface IConfigService<out T> : IDisposable where T : IMareConfiguratio
|
||||||
string ConfigurationName { get; }
|
string ConfigurationName { get; }
|
||||||
string ConfigurationPath { get; }
|
string ConfigurationPath { get; }
|
||||||
public event EventHandler? ConfigSave;
|
public event EventHandler? ConfigSave;
|
||||||
|
void UpdateLastWriteTime();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue