fix: save config + manifests by first writing them to another file and moving them over

Should hopefully make corrupted configs a bit more rare
This commit is contained in:
goat 2023-03-19 13:11:27 +01:00
parent 111eea290c
commit 86181cd2d4
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
4 changed files with 22 additions and 6 deletions

View file

@ -355,17 +355,17 @@ internal sealed class DalamudConfiguration : IServiceType
/// Gets or sets hitch threshold for game network up in milliseconds.
/// </summary>
public double GameNetworkUpHitch { get; set; } = 30;
/// <summary>
/// Gets or sets hitch threshold for game network down in milliseconds.
/// </summary>
public double GameNetworkDownHitch { get; set; } = 30;
/// <summary>
/// Gets or sets hitch threshold for framework update in milliseconds.
/// </summary>
public double FrameworkUpdateHitch { get; set; } = 50;
/// <summary>
/// Gets or sets hitch threshold for ui builder in milliseconds.
/// </summary>
@ -428,7 +428,7 @@ internal sealed class DalamudConfiguration : IServiceType
{
ThreadSafety.AssertMainThread();
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, SerializerSettings));
Util.WriteAllTextSafe(this.configPath, JsonConvert.SerializeObject(this, SerializerSettings));
this.DalamudConfigurationSaved?.Invoke(this);
}
}