mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 07:17:53 +01:00
Update AdvancedEditingOpen ephemeral setting
This commit is contained in:
parent
34f067f13d
commit
2742e4d485
5 changed files with 32 additions and 11 deletions
|
|
@ -32,6 +32,24 @@ public class ModStorage : IReadOnlyList<Mod>
|
|||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> GetEnumerator();
|
||||
|
||||
/// <summary>
|
||||
/// Try to obtain a mod by its directory name (unique identifier).
|
||||
/// </summary>
|
||||
public bool TryGetMod(string identifier, [NotNullWhen(true)] out Mod? mod)
|
||||
{
|
||||
foreach (var m in Mods)
|
||||
{
|
||||
if (string.Equals(m.Identifier, identifier, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
mod = m;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
mod = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to obtain a mod by its directory name (unique identifier, preferred),
|
||||
/// or the first mod of the given name if no directory fits.
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public class ModSelection : EventBase<ModSelection.Arguments, ModSelection.Prior
|
|||
_communicator = communicator;
|
||||
_collections = collections;
|
||||
_config = config;
|
||||
if (_config.LastModPath.Length > 0)
|
||||
SelectMod(mods.FirstOrDefault(m => string.Equals(m.Identifier, config.LastModPath, StringComparison.OrdinalIgnoreCase)));
|
||||
if (_config.LastModPath.Length > 0 && mods.TryGetMod(config.LastModPath, out var mod))
|
||||
SelectMod(mod);
|
||||
|
||||
_communicator.CollectionChange.Subscribe(OnCollectionChange, CollectionChange.Priority.ModSelection);
|
||||
_communicator.CollectionInheritanceChanged.Subscribe(OnInheritanceChange, CollectionInheritanceChanged.Priority.ModSelection);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue