mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
fix: save DalamudConfiguration with full type information
This commit is contained in:
parent
6f04f771e9
commit
913b0f157c
1 changed files with 9 additions and 2 deletions
|
|
@ -16,6 +16,13 @@ namespace Dalamud.Configuration.Internal
|
||||||
[Serializable]
|
[Serializable]
|
||||||
internal sealed class DalamudConfiguration
|
internal sealed class DalamudConfiguration
|
||||||
{
|
{
|
||||||
|
private static readonly JsonSerializerSettings SerializerSettings = new()
|
||||||
|
{
|
||||||
|
TypeNameHandling = TypeNameHandling.All,
|
||||||
|
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Full,
|
||||||
|
Formatting = Formatting.Indented,
|
||||||
|
};
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private string configPath;
|
private string configPath;
|
||||||
|
|
||||||
|
|
@ -238,7 +245,7 @@ namespace Dalamud.Configuration.Internal
|
||||||
DalamudConfiguration deserialized;
|
DalamudConfiguration deserialized;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
deserialized = JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
|
deserialized = JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path), SerializerSettings);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -256,7 +263,7 @@ namespace Dalamud.Configuration.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, SerializerSettings));
|
||||||
this.DalamudConfigurationSaved?.Invoke(this);
|
this.DalamudConfigurationSaved?.Invoke(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue