mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 00:07:53 +01:00
Delete default meta entries from archives and api added mods if not configured otherwise.
This commit is contained in:
parent
f8e3b6777f
commit
f5e6132462
14 changed files with 95 additions and 73 deletions
|
|
@ -225,7 +225,7 @@ public class DuplicateManager(ModManager modManager, SaveService saveService, Co
|
|||
if (!useModManager || !modManager.TryGetMod(modDirectory.Name, string.Empty, out var mod))
|
||||
{
|
||||
mod = new Mod(modDirectory);
|
||||
modManager.Creator.ReloadMod(mod, true, out _);
|
||||
modManager.Creator.ReloadMod(mod, true, true, out _);
|
||||
}
|
||||
|
||||
Clear();
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public class ModFileEditor(ModFileCollection files, ModManager modManager, Commu
|
|||
if (deletions <= 0)
|
||||
return;
|
||||
|
||||
modManager.Creator.ReloadMod(mod, false, out _);
|
||||
modManager.Creator.ReloadMod(mod, false, false, out _);
|
||||
files.UpdateAll(mod, option);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ public class ModMerger : IDisposable, IService
|
|||
if (dir == null)
|
||||
throw new Exception($"Could not split off mods, unable to create new mod with name {modName}.");
|
||||
|
||||
_mods.AddMod(dir);
|
||||
_mods.AddMod(dir, false);
|
||||
result = _mods[^1];
|
||||
if (mods.Count == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,12 +3,15 @@ using OtterGui.Services;
|
|||
using Penumbra.Meta;
|
||||
using Penumbra.Meta.Files;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Mods.Manager.OptionEditor;
|
||||
using Penumbra.Mods.SubMods;
|
||||
|
||||
namespace Penumbra.Mods.Editor;
|
||||
|
||||
public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManager, ImcChecker imcChecker) : MetaDictionary, IService
|
||||
public class ModMetaEditor(
|
||||
ModGroupEditor groupEditor,
|
||||
MetaFileManager metaFileManager,
|
||||
ImcChecker imcChecker) : MetaDictionary, IService
|
||||
{
|
||||
public sealed class OtherOptionData : HashSet<string>
|
||||
{
|
||||
|
|
@ -64,11 +67,11 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
Changes = false;
|
||||
}
|
||||
|
||||
public bool DeleteDefaultValues(MetaDictionary dict)
|
||||
public static bool DeleteDefaultValues(MetaFileManager metaFileManager, ImcChecker imcChecker, MetaDictionary dict)
|
||||
{
|
||||
var clone = dict.Clone();
|
||||
dict.Clear();
|
||||
var ret = false;
|
||||
var count = 0;
|
||||
foreach (var (key, value) in clone.Imc)
|
||||
{
|
||||
var defaultEntry = imcChecker.GetDefaultEntry(key, false);
|
||||
|
|
@ -79,7 +82,7 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Deleted default-valued meta-entry {key}.");
|
||||
ret = true;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +96,7 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Deleted default-valued meta-entry {key}.");
|
||||
ret = true;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +110,7 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Deleted default-valued meta-entry {key}.");
|
||||
ret = true;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +124,7 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Deleted default-valued meta-entry {key}.");
|
||||
ret = true;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +138,7 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Deleted default-valued meta-entry {key}.");
|
||||
ret = true;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,22 +152,26 @@ public class ModMetaEditor(ModManager modManager, MetaFileManager metaFileManage
|
|||
else
|
||||
{
|
||||
Penumbra.Log.Verbose($"Deleted default-valued meta-entry {key}.");
|
||||
ret = true;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
if (count <= 0)
|
||||
return false;
|
||||
|
||||
Penumbra.Log.Debug($"Deleted {count} default-valued meta-entries from a mod option.");
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DeleteDefaultValues()
|
||||
=> Changes = DeleteDefaultValues(this);
|
||||
=> Changes = DeleteDefaultValues(metaFileManager, imcChecker, this);
|
||||
|
||||
public void Apply(IModDataContainer container)
|
||||
{
|
||||
if (!Changes)
|
||||
return;
|
||||
|
||||
modManager.OptionEditor.SetManipulations(container, this);
|
||||
groupEditor.SetManipulations(container, this);
|
||||
Changes = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class ModNormalizer(ModManager modManager, Configuration config, SaveServ
|
|||
if (!config.AutoReduplicateUiOnImport)
|
||||
return;
|
||||
|
||||
if (modManager.Creator.LoadMod(modDirectory, false) is not { } mod)
|
||||
if (modManager.Creator.LoadMod(modDirectory, false, false) is not { } mod)
|
||||
return;
|
||||
|
||||
Dictionary<FullPath, List<(IModDataContainer, Utf8GamePath)>> paths = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue