mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
don't save windows that haven't changed
This commit is contained in:
parent
cac76f045b
commit
d22ff8fad8
2 changed files with 19 additions and 1 deletions
|
|
@ -49,5 +49,13 @@ internal class PresetModel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("a")]
|
[JsonProperty("a")]
|
||||||
public float? Alpha { get; set; }
|
public float? Alpha { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this preset is in the default state.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDefault =>
|
||||||
|
!this.IsPinned &&
|
||||||
|
!this.IsClickThrough &&
|
||||||
|
!this.Alpha.HasValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,17 @@ internal class WindowSystemPersistence : IServiceType
|
||||||
/// <param name="window">The preset window instance.</param>
|
/// <param name="window">The preset window instance.</param>
|
||||||
public void SaveWindow(uint id, PresetModel.PresetWindow window)
|
public void SaveWindow(uint id, PresetModel.PresetWindow window)
|
||||||
{
|
{
|
||||||
this.ActivePreset.Windows[id] = window;
|
// If the window is in the default state, don't save it to avoid saving every possible window
|
||||||
|
// if the user has not customized anything.
|
||||||
|
if (window.IsDefault)
|
||||||
|
{
|
||||||
|
this.ActivePreset.Windows.Remove(id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.ActivePreset.Windows[id] = window;
|
||||||
|
}
|
||||||
|
|
||||||
this.config.QueueSave();
|
this.config.QueueSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue