mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 04:34:19 +01:00
Fix inheritance save issues and sort mod settings on collection save.
This commit is contained in:
parent
4298b46130
commit
5567134a56
5 changed files with 43 additions and 63 deletions
|
|
@ -48,17 +48,18 @@ internal readonly struct ModCollectionSave : ISavable
|
|||
|
||||
// Write all used and unused settings by mod directory name.
|
||||
j.WriteStartObject();
|
||||
var list = new List<(string, ModSettings.SavedSettings)>(_modCollection.Settings.Count + _modCollection.UnusedSettings.Count);
|
||||
for (var i = 0; i < _modCollection.Settings.Count; ++i)
|
||||
{
|
||||
var settings = _modCollection.Settings[i];
|
||||
if (settings != null)
|
||||
{
|
||||
j.WritePropertyName(_modStorage[i].ModPath.Name);
|
||||
x.Serialize(j, new ModSettings.SavedSettings(settings, _modStorage[i]));
|
||||
}
|
||||
list.Add((_modStorage[i].ModPath.Name, new ModSettings.SavedSettings(settings, _modStorage[i])));
|
||||
}
|
||||
|
||||
foreach (var (modDir, settings) in _modCollection.UnusedSettings)
|
||||
list.AddRange(_modCollection.UnusedSettings.Select(kvp => (kvp.Key, kvp.Value)));
|
||||
list.Sort((a, b) => string.Compare(a.Item1, b.Item1, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
foreach (var (modDir, settings) in list)
|
||||
{
|
||||
j.WritePropertyName(modDir);
|
||||
x.Serialize(j, settings);
|
||||
|
|
@ -67,8 +68,8 @@ internal readonly struct ModCollectionSave : ISavable
|
|||
j.WriteEndObject();
|
||||
|
||||
// Inherit by collection name.
|
||||
j.WritePropertyName("Inheritance");
|
||||
x.Serialize(j, _modCollection.DirectlyInheritsFrom.Select(c => c.Name));
|
||||
j.WritePropertyName("Inheritance");
|
||||
x.Serialize(j, _modCollection.InheritanceByName ?? _modCollection.DirectlyInheritsFrom.Select(c => c.Name));
|
||||
j.WriteEndObject();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue