mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 23:37:47 +01:00
Get rid of OtterGui event wrappers.
This commit is contained in:
parent
3ce02b506e
commit
c423ce1d47
103 changed files with 1050 additions and 1024 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using Luna.Files;
|
||||
using Luna;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Mods.SubMods;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Mods.SubMods;
|
||||
using Penumbra.Services;
|
||||
|
|
@ -137,7 +138,7 @@ public class ModFileEditor(ModFileCollection files, ModManager modManager, Commu
|
|||
try
|
||||
{
|
||||
File.Delete(file.File.FullName);
|
||||
communicator.ModFileChanged.Invoke(mod, file);
|
||||
communicator.ModFileChanged.Invoke(new ModFileChanged.Arguments(mod, file));
|
||||
Penumbra.Log.Debug($"[DeleteFiles] Deleted {file.File.FullName} from {mod.Name}.");
|
||||
++deletions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Dalamud.Utility;
|
||||
using Luna;
|
||||
using Luna.Files;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Groups;
|
||||
|
|
@ -478,27 +477,27 @@ public class ModMerger : IDisposable, IService
|
|||
}
|
||||
}
|
||||
|
||||
private void OnSelectionChange(Mod? oldSelection, Mod? newSelection)
|
||||
private void OnSelectionChange(in ModSelection.Arguments arguments)
|
||||
{
|
||||
if (OptionGroupName == "Merges" && OptionName.Length == 0 || OptionName == oldSelection?.Name.Text)
|
||||
OptionName = newSelection?.Name.Text ?? string.Empty;
|
||||
if (OptionGroupName == "Merges" && OptionName.Length == 0 || OptionName == arguments.OldSelection?.Name.Text)
|
||||
OptionName = arguments.NewSelection?.Name.Text ?? string.Empty;
|
||||
|
||||
if (MergeToMod == newSelection)
|
||||
if (MergeToMod == arguments.NewSelection)
|
||||
MergeToMod = null;
|
||||
|
||||
SelectedOptions.Clear();
|
||||
}
|
||||
|
||||
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? _1, DirectoryInfo? _2)
|
||||
private void OnModPathChange(in ModPathChanged.Arguments arguments)
|
||||
{
|
||||
switch (type)
|
||||
switch (arguments.Type)
|
||||
{
|
||||
case ModPathChangeType.Deleted:
|
||||
{
|
||||
if (mod == MergeFromMod)
|
||||
if (arguments.Mod == MergeFromMod)
|
||||
SelectedOptions.Clear();
|
||||
|
||||
if (mod == MergeToMod)
|
||||
if (arguments.Mod == MergeToMod)
|
||||
MergeToMod = null;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Luna;
|
||||
using Luna.Files;
|
||||
using OtterGui.Tasks;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Manager;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Luna.Files;
|
||||
using Luna;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using Penumbra.Communication;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Manager.OptionEditor;
|
||||
using Penumbra.Mods.SubMods;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
@ -39,52 +37,51 @@ public class ModCacheManager : IDisposable, Luna.IService
|
|||
_communicator.ModDiscoveryFinished.Unsubscribe(OnModDiscoveryFinished);
|
||||
}
|
||||
|
||||
private void OnModOptionChange(ModOptionChangeType type, Mod mod, IModGroup? group, IModOption? option, IModDataContainer? container,
|
||||
int fromIdx)
|
||||
private void OnModOptionChange(in ModOptionChanged.Arguments arguments)
|
||||
{
|
||||
switch (type)
|
||||
switch (arguments.Type)
|
||||
{
|
||||
case ModOptionChangeType.GroupAdded:
|
||||
case ModOptionChangeType.GroupDeleted:
|
||||
case ModOptionChangeType.OptionAdded:
|
||||
case ModOptionChangeType.OptionDeleted:
|
||||
UpdateChangedItems(mod);
|
||||
UpdateCounts(mod);
|
||||
UpdateChangedItems(arguments.Mod);
|
||||
UpdateCounts(arguments.Mod);
|
||||
break;
|
||||
case ModOptionChangeType.GroupTypeChanged:
|
||||
UpdateHasOptions(mod);
|
||||
UpdateHasOptions(arguments.Mod);
|
||||
break;
|
||||
case ModOptionChangeType.OptionFilesChanged:
|
||||
case ModOptionChangeType.OptionFilesAdded:
|
||||
UpdateChangedItems(mod);
|
||||
UpdateFileCount(mod);
|
||||
UpdateChangedItems(arguments.Mod);
|
||||
UpdateFileCount(arguments.Mod);
|
||||
break;
|
||||
case ModOptionChangeType.OptionSwapsChanged:
|
||||
UpdateChangedItems(mod);
|
||||
UpdateSwapCount(mod);
|
||||
UpdateChangedItems(arguments.Mod);
|
||||
UpdateSwapCount(arguments.Mod);
|
||||
break;
|
||||
case ModOptionChangeType.OptionMetaChanged:
|
||||
UpdateChangedItems(mod);
|
||||
UpdateMetaCount(mod);
|
||||
UpdateChangedItems(arguments.Mod);
|
||||
UpdateMetaCount(arguments.Mod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? old, DirectoryInfo? @new)
|
||||
private void OnModPathChange(in ModPathChanged.Arguments arguments)
|
||||
{
|
||||
switch (type)
|
||||
switch (arguments.Type)
|
||||
{
|
||||
case ModPathChangeType.Added:
|
||||
case ModPathChangeType.Reloaded:
|
||||
RefreshWithChangedItems(mod);
|
||||
RefreshWithChangedItems(arguments.Mod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnModDataChange(ModDataChangeType type, Mod mod, string? _)
|
||||
private static void OnModDataChange(in ModDataChanged.Arguments arguments)
|
||||
{
|
||||
if ((type & (ModDataChangeType.LocalTags | ModDataChangeType.ModTags)) != 0)
|
||||
UpdateTags(mod);
|
||||
if ((arguments.Type & (ModDataChangeType.LocalTags | ModDataChangeType.ModTags)) is not 0)
|
||||
UpdateTags(arguments.Mod);
|
||||
}
|
||||
|
||||
private void OnModDiscoveryFinished()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Dalamud.Utility;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Services;
|
||||
|
|
@ -55,7 +56,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
var oldName = mod.Name;
|
||||
mod.Name = newName;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Name, mod, oldName.Text);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Name, mod, oldName.Text));
|
||||
}
|
||||
|
||||
public void ChangeModAuthor(Mod mod, string newAuthor)
|
||||
|
|
@ -65,7 +66,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.Author = newAuthor;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Author, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Author, mod, null));
|
||||
}
|
||||
|
||||
public void ChangeModDescription(Mod mod, string newDescription)
|
||||
|
|
@ -75,7 +76,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.Description = newDescription;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Description, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Description, mod, null));
|
||||
}
|
||||
|
||||
public void ChangeModVersion(Mod mod, string newVersion)
|
||||
|
|
@ -85,7 +86,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.Version = newVersion;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Version, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Version, mod, null));
|
||||
}
|
||||
|
||||
public void ChangeModWebsite(Mod mod, string newWebsite)
|
||||
|
|
@ -95,7 +96,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.Website = newWebsite;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Website, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Website, mod, null));
|
||||
}
|
||||
|
||||
public void ChangeRequiredFeatures(Mod mod, FeatureFlags flags)
|
||||
|
|
@ -105,7 +106,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.RequiredFeatures = flags;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.RequiredFeatures, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.RequiredFeatures, mod, null));
|
||||
}
|
||||
|
||||
public void ChangeModTag(Mod mod, int tagIdx, string newTag)
|
||||
|
|
@ -121,7 +122,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.Favorite = state;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Favorite, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Favorite, mod, null));
|
||||
}
|
||||
|
||||
public void ResetModImportDate(Mod mod)
|
||||
|
|
@ -132,7 +133,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.ImportDate = newDate;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.ImportDate, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.ImportDate, mod, null));
|
||||
}
|
||||
|
||||
public void ChangeModNote(Mod mod, string newNote)
|
||||
|
|
@ -142,7 +143,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
|
||||
mod.Note = newNote;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.Favorite, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.Favorite, mod, null));
|
||||
}
|
||||
|
||||
private void ChangeTag(Mod mod, int tagIdx, string newTag, bool local)
|
||||
|
|
@ -170,7 +171,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
saveService.QueueSave(new ModLocalData(mod));
|
||||
|
||||
if (flags != 0)
|
||||
communicatorService.ModDataChanged.Invoke(flags, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(flags, mod, null));
|
||||
}
|
||||
|
||||
public void MoveDataFile(DirectoryInfo oldMod, DirectoryInfo newMod)
|
||||
|
|
@ -196,13 +197,13 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
{
|
||||
++mod.LastChangedItemsUpdate;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.PreferredChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.PreferredChangedItems, mod, null));
|
||||
}
|
||||
|
||||
if (toDefault && CleanExisting(mod.DefaultPreferredItems))
|
||||
{
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.DefaultChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.DefaultChangedItems, mod, null));
|
||||
}
|
||||
|
||||
bool CleanExisting(HashSet<CustomItemId> items)
|
||||
|
|
@ -251,13 +252,13 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
{
|
||||
++mod.LastChangedItemsUpdate;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.PreferredChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.PreferredChangedItems, mod, null));
|
||||
}
|
||||
|
||||
if (fromDefault && mod.DefaultPreferredItems.Remove(id))
|
||||
{
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.DefaultChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.DefaultChangedItems, mod, null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +272,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
mod.PreferredChangedItems = newSet;
|
||||
++mod.LastChangedItemsUpdate;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.PreferredChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.PreferredChangedItems, mod, null));
|
||||
}
|
||||
|
||||
newSet = new HashSet<CustomItemId>(mod.DefaultPreferredItems.Count);
|
||||
|
|
@ -279,7 +280,7 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
{
|
||||
mod.DefaultPreferredItems = newSet;
|
||||
saveService.QueueSave(new ModMeta(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.DefaultChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.DefaultChangedItems, mod, null));
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -308,6 +309,6 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic
|
|||
mod.PreferredChangedItems.UnionWith(mod.DefaultPreferredItems);
|
||||
++mod.LastChangedItemsUpdate;
|
||||
saveService.QueueSave(new ModLocalData(mod));
|
||||
communicatorService.ModDataChanged.Invoke(ModDataChangeType.PreferredChangedItems, mod, null);
|
||||
communicatorService.ModDataChanged.Invoke(new ModDataChanged.Arguments(ModDataChangeType.PreferredChangedItems, mod, null));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,14 +79,13 @@ public class ModExportManager : IDisposable, Luna.IService
|
|||
=> _communicator.ModPathChanged.Unsubscribe(OnModPathChange);
|
||||
|
||||
/// <summary> Automatically migrate the backup file to the new name if any exists. </summary>
|
||||
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? oldDirectory,
|
||||
DirectoryInfo? newDirectory)
|
||||
private void OnModPathChange(in ModPathChanged.Arguments arguments)
|
||||
{
|
||||
if (type is not ModPathChangeType.Moved || oldDirectory == null || newDirectory == null)
|
||||
if (arguments.Type is not ModPathChangeType.Moved || arguments.OldDirectory is null || arguments.NewDirectory is null)
|
||||
return;
|
||||
|
||||
mod.ModPath = oldDirectory;
|
||||
new ModBackup(this, mod).Move(null, newDirectory.Name);
|
||||
mod.ModPath = newDirectory;
|
||||
arguments.Mod.ModPath = arguments.OldDirectory;
|
||||
new ModBackup(this, arguments.Mod).Move(null, arguments.NewDirectory.Name);
|
||||
arguments.Mod.ModPath = arguments.NewDirectory;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,21 +77,21 @@ public sealed class ModFileSystem : FileSystem<Mod>, IDisposable, ISavable, ISer
|
|||
}
|
||||
|
||||
// Update sort order when defaulted mod names change.
|
||||
private void OnModDataChange(ModDataChangeType type, Mod mod, string? oldName)
|
||||
private void OnModDataChange(in ModDataChanged.Arguments arguments)
|
||||
{
|
||||
if (!type.HasFlag(ModDataChangeType.Name) || oldName == null || !TryGetValue(mod, out var leaf))
|
||||
if (!arguments.Type.HasFlag(ModDataChangeType.Name) || arguments.OldName == null || !TryGetValue(arguments.Mod, out var leaf))
|
||||
return;
|
||||
|
||||
var old = oldName.FixName();
|
||||
var old = arguments.OldName.FixName();
|
||||
if (old == leaf.Name || leaf.Name.IsDuplicateName(out var baseName, out _) && baseName == old)
|
||||
RenameWithDuplicates(leaf, mod.Name.Text);
|
||||
RenameWithDuplicates(leaf, arguments.Mod.Name.Text);
|
||||
}
|
||||
|
||||
// Update the filesystem if a mod has been added or removed.
|
||||
// Save it, if the mod directory has been moved, since this will change the save format.
|
||||
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? oldPath, DirectoryInfo? newPath)
|
||||
private void OnModPathChange(in ModPathChanged.Arguments arguments)
|
||||
{
|
||||
switch (type)
|
||||
switch (arguments.Type)
|
||||
{
|
||||
case ModPathChangeType.Added:
|
||||
var parent = Root;
|
||||
|
|
@ -103,14 +103,14 @@ public sealed class ModFileSystem : FileSystem<Mod>, IDisposable, ISavable, ISer
|
|||
catch (Exception e)
|
||||
{
|
||||
Penumbra.Messager.NotificationMessage(e,
|
||||
$"Could not move newly imported mod {mod.Name} to default import folder {_config.DefaultImportFolder}.",
|
||||
$"Could not move newly imported mod {arguments.Mod.Name} to default import folder {_config.DefaultImportFolder}.",
|
||||
NotificationType.Warning);
|
||||
}
|
||||
|
||||
CreateDuplicateLeaf(parent, mod.Name.Text, mod);
|
||||
CreateDuplicateLeaf(parent, arguments.Mod.Name.Text, arguments.Mod);
|
||||
break;
|
||||
case ModPathChangeType.Deleted:
|
||||
if (TryGetValue(mod, out var leaf))
|
||||
if (TryGetValue(arguments.Mod, out var leaf))
|
||||
Delete(leaf);
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
|
||||
mod.Index = Count;
|
||||
Mods.Add(mod);
|
||||
_communicator.ModPathChanged.Invoke(ModPathChangeType.Added, mod, null, mod.ModPath);
|
||||
_communicator.ModPathChanged.Invoke(new ModPathChanged.Arguments(ModPathChangeType.Added, mod, null, mod.ModPath));
|
||||
Penumbra.Log.Debug($"Added new mod {mod.Name} from {modFolder.FullName}.");
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
/// </summary>
|
||||
public void RemoveMod(Mod mod)
|
||||
{
|
||||
_communicator.ModPathChanged.Invoke(ModPathChangeType.Deleted, mod, mod.ModPath, null);
|
||||
_communicator.ModPathChanged.Invoke(new ModPathChanged.Arguments(ModPathChangeType.Deleted, mod, mod.ModPath, null));
|
||||
foreach (var remainingMod in Mods.Skip(mod.Index + 1))
|
||||
--remainingMod.Index;
|
||||
Mods.RemoveAt(mod.Index);
|
||||
|
|
@ -140,7 +140,7 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
{
|
||||
var oldName = mod.Name;
|
||||
|
||||
_communicator.ModPathChanged.Invoke(ModPathChangeType.StartingReload, mod, mod.ModPath, mod.ModPath);
|
||||
_communicator.ModPathChanged.Invoke(new ModPathChanged.Arguments(ModPathChangeType.StartingReload, mod, mod.ModPath, mod.ModPath));
|
||||
if (!Creator.ReloadMod(mod, true, false, out var metaChange))
|
||||
{
|
||||
if (mod.RequiredFeatures is not FeatureFlags.Invalid)
|
||||
|
|
@ -151,9 +151,9 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
return;
|
||||
}
|
||||
|
||||
_communicator.ModPathChanged.Invoke(ModPathChangeType.Reloaded, mod, mod.ModPath, mod.ModPath);
|
||||
_communicator.ModPathChanged.Invoke(new ModPathChanged.Arguments(ModPathChangeType.Reloaded, mod, mod.ModPath, mod.ModPath));
|
||||
if (metaChange != ModDataChangeType.None)
|
||||
_communicator.ModDataChanged.Invoke(metaChange, mod, oldName);
|
||||
_communicator.ModDataChanged.Invoke(new ModDataChanged.Arguments(metaChange, mod, oldName));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -213,9 +213,9 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
return;
|
||||
}
|
||||
|
||||
_communicator.ModPathChanged.Invoke(ModPathChangeType.Moved, mod, oldDirectory, dir);
|
||||
_communicator.ModPathChanged.Invoke(new ModPathChanged.Arguments(ModPathChangeType.Moved, mod, oldDirectory, dir));
|
||||
if (metaChange != ModDataChangeType.None)
|
||||
_communicator.ModDataChanged.Invoke(metaChange, mod, oldName);
|
||||
_communicator.ModDataChanged.Invoke(new ModDataChanged.Arguments(metaChange, mod, oldName));
|
||||
}
|
||||
|
||||
/// <summary> Return the state of the new potential name of a directory. </summary>
|
||||
|
|
@ -247,16 +247,15 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
|
||||
|
||||
/// <summary> Add new mods to NewMods and remove deleted mods from NewMods. </summary>
|
||||
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? oldDirectory,
|
||||
DirectoryInfo? newDirectory)
|
||||
private void OnModPathChange(in ModPathChanged.Arguments arguments)
|
||||
{
|
||||
switch (type)
|
||||
switch (arguments.Type)
|
||||
{
|
||||
case ModPathChangeType.Added: SetNew(mod); break;
|
||||
case ModPathChangeType.Deleted: SetKnown(mod); break;
|
||||
case ModPathChangeType.Added: SetNew(arguments.Mod); break;
|
||||
case ModPathChangeType.Deleted: SetKnown(arguments.Mod); break;
|
||||
case ModPathChangeType.Moved:
|
||||
if (oldDirectory != null && newDirectory != null)
|
||||
DataEditor.MoveDataFile(oldDirectory, newDirectory);
|
||||
if (arguments.OldDirectory is not null && arguments.NewDirectory is not null)
|
||||
DataEditor.MoveDataFile(arguments.OldDirectory, arguments.NewDirectory);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -313,7 +312,7 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
_config.ModDirectory = newPath;
|
||||
_config.Save();
|
||||
Penumbra.Log.Information($"Set new mod base directory from {_config.ModDirectory} to {newPath}.");
|
||||
_communicator.ModDirectoryChanged.Invoke(newPath, valid);
|
||||
_communicator.ModDirectoryChanged.Invoke(new ModDirectoryChanged.Arguments(newPath, valid));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -346,7 +345,7 @@ public sealed class ModManager : ModStorage, IDisposable, Luna.IService
|
|||
catch (Exception ex)
|
||||
{
|
||||
Valid = false;
|
||||
_communicator.ModDirectoryChanged.Invoke(BasePath.FullName, false);
|
||||
_communicator.ModDirectoryChanged.Invoke(new ModDirectoryChanged.Arguments(BasePath.FullName, false));
|
||||
Penumbra.Log.Error($"Could not scan for mods:\n{ex}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Luna;
|
||||
using Luna.Files;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Settings;
|
||||
using Penumbra.Mods.SubMods;
|
||||
|
|
@ -42,6 +42,6 @@ public sealed class CombiningModGroupEditor(CommunicatorService communicator, Sa
|
|||
|
||||
container.Name = name;
|
||||
SaveService.Save(saveType, new ModSaveGroup(container.Group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, container.Group.Mod, container.Group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.DisplayChange, container.Group.Mod, container.Group, null, null, -1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Luna.Files;
|
||||
using Luna;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods.Groups;
|
||||
|
|
@ -10,7 +11,7 @@ using Penumbra.Services;
|
|||
namespace Penumbra.Mods.Manager.OptionEditor;
|
||||
|
||||
public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveService saveService, Configuration config)
|
||||
: ModOptionEditor<ImcModGroup, ImcSubMod>(communicator, saveService, config), Luna.IService
|
||||
: ModOptionEditor<ImcModGroup, ImcSubMod>(communicator, saveService, config), IService
|
||||
{
|
||||
/// <summary> Add a new, empty imc group with the given manipulation data. </summary>
|
||||
public ImcModGroup? AddModGroup(Mod mod, string newName, ImcIdentifier identifier, ImcEntry defaultEntry,
|
||||
|
|
@ -23,7 +24,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
var group = CreateGroup(mod, newName, identifier, defaultEntry, maxPriority);
|
||||
mod.Groups.Add(group);
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupAdded, mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupAdded, mod, group, null, null, -1));
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
};
|
||||
group.OptionData.Add(subMod);
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionAdded, group.Mod, group, subMod, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionAdded, group.Mod, group, subMod, null, -1));
|
||||
return subMod;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
return;
|
||||
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
public void ChangeDefaultEntry(ImcModGroup group, in ImcEntry newEntry, SaveType saveType = SaveType.Queue)
|
||||
|
|
@ -66,7 +67,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
|
||||
group.DefaultEntry = entry;
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
public void ChangeOptionAttribute(ImcSubMod option, in ImcAttributeCache cache, int idx, bool value, SaveType saveType = SaveType.Queue)
|
||||
|
|
@ -75,7 +76,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
return;
|
||||
|
||||
SaveService.Save(saveType, new ModSaveGroup(option.Group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, option.Mod, option.Group, option, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, option.Mod, option.Group, option, null, -1));
|
||||
}
|
||||
|
||||
public void ChangeAllVariants(ImcModGroup group, bool allVariants, SaveType saveType = SaveType.Queue)
|
||||
|
|
@ -85,7 +86,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
|
||||
group.AllVariants = allVariants;
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
public void ChangeOnlyAttributes(ImcModGroup group, bool onlyAttributes, SaveType saveType = SaveType.Queue)
|
||||
|
|
@ -95,7 +96,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
|
||||
group.OnlyAttributes = onlyAttributes;
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
public void ChangeCanBeDisabled(ImcModGroup group, bool canBeDisabled, SaveType saveType = SaveType.Queue)
|
||||
|
|
@ -105,7 +106,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
|
||||
group.CanBeDisabled = canBeDisabled;
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
protected override ImcModGroup CreateGroup(Mod mod, string newName, ModPriority priority, SaveType saveType = SaveType.ImmediateSync)
|
||||
|
|
@ -116,8 +117,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
};
|
||||
|
||||
|
||||
private static ImcModGroup CreateGroup(Mod mod, string newName, ImcIdentifier identifier, ImcEntry defaultEntry, ModPriority priority,
|
||||
SaveType saveType = SaveType.ImmediateSync)
|
||||
private static ImcModGroup CreateGroup(Mod mod, string newName, ImcIdentifier identifier, ImcEntry defaultEntry, ModPriority priority, SaveType saveType = SaveType.ImmediateSync)
|
||||
=> new(mod)
|
||||
{
|
||||
Name = newName,
|
||||
|
|
@ -137,7 +137,7 @@ public sealed class ImcModGroupEditor(CommunicatorService communicator, SaveServ
|
|||
|
||||
protected override bool MoveOption(ImcModGroup group, int optionIdxFrom, int optionIdxTo)
|
||||
{
|
||||
if (!group.OptionData.Move(ref optionIdxFrom, ref optionIdxTo))
|
||||
if (!Extensions.Move(group.OptionData, ref optionIdxFrom, ref optionIdxTo))
|
||||
return false;
|
||||
|
||||
group.DefaultSettings = group.DefaultSettings.MoveBit(optionIdxFrom, optionIdxTo);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Luna.Files;
|
||||
using Luna;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Settings;
|
||||
|
|
@ -62,7 +62,7 @@ public class ModGroupEditor(
|
|||
|
||||
group.DefaultSettings = defaultOption;
|
||||
saveService.QueueSave(new ModSaveGroup(group, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DefaultOptionChanged, group.Mod, group, null, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.DefaultOptionChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Rename an option group if possible. </summary>
|
||||
|
|
@ -75,7 +75,7 @@ public class ModGroupEditor(
|
|||
saveService.ImmediateDelete(new ModSaveGroup(group, config.ReplaceNonAsciiOnImport));
|
||||
group.Name = newName;
|
||||
saveService.ImmediateSave(new ModSaveGroup(group, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupRenamed, group.Mod, group, null, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupRenamed, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Delete a given option group. Fires an event to prepare before actually deleting. </summary>
|
||||
|
|
@ -83,10 +83,10 @@ public class ModGroupEditor(
|
|||
{
|
||||
var mod = group.Mod;
|
||||
var idx = group.GetIndex();
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, mod, group, null, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PrepareChange, mod, group, null, null, -1));
|
||||
mod.Groups.RemoveAt(idx);
|
||||
saveService.SaveAllOptionGroups(mod, false, config.ReplaceNonAsciiOnImport);
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupDeleted, mod, null, null, null, idx);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupDeleted, mod, null, null, null, idx));
|
||||
}
|
||||
|
||||
/// <summary> Move the index of a given option group. </summary>
|
||||
|
|
@ -98,7 +98,7 @@ public class ModGroupEditor(
|
|||
return;
|
||||
|
||||
saveService.SaveAllOptionGroups(mod, false, config.ReplaceNonAsciiOnImport);
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupMoved, mod, group, null, null, idxFrom);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupMoved, mod, group, null, null, idxFrom));
|
||||
}
|
||||
|
||||
/// <summary> Change the internal priority of the given option group. </summary>
|
||||
|
|
@ -109,7 +109,7 @@ public class ModGroupEditor(
|
|||
|
||||
group.Priority = newPriority;
|
||||
saveService.QueueSave(new ModSaveGroup(group, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PriorityChanged, group.Mod, group, null, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PriorityChanged, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Change the description of the given option group. </summary>
|
||||
|
|
@ -120,7 +120,7 @@ public class ModGroupEditor(
|
|||
|
||||
group.Description = newDescription;
|
||||
saveService.QueueSave(new ModSaveGroup(group, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, group.Mod, group, null, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.DisplayChange, group.Mod, group, null, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Rename the given option. </summary>
|
||||
|
|
@ -131,7 +131,7 @@ public class ModGroupEditor(
|
|||
|
||||
option.Name = newName;
|
||||
saveService.QueueSave(new ModSaveGroup(option.Group, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, option.Mod, option.Group, option, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.DisplayChange, option.Mod, option.Group, option, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Change the description of the given option. </summary>
|
||||
|
|
@ -142,7 +142,7 @@ public class ModGroupEditor(
|
|||
|
||||
option.Description = newDescription;
|
||||
saveService.QueueSave(new ModSaveGroup(option.Group, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.DisplayChange, option.Mod, option.Group, option, null, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.DisplayChange, option.Mod, option.Group, option, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Set the meta manipulations for a given option. Replaces existing manipulations. </summary>
|
||||
|
|
@ -151,10 +151,10 @@ public class ModGroupEditor(
|
|||
if (subMod.Manipulations.Equals(manipulations))
|
||||
return;
|
||||
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
subMod.Manipulations.SetTo(manipulations);
|
||||
saveService.Save(saveType, new ModSaveGroup(subMod, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMetaChanged, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMetaChanged, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
}
|
||||
|
||||
/// <summary> Set the file redirections for a given option. Replaces existing redirections. </summary>
|
||||
|
|
@ -163,10 +163,10 @@ public class ModGroupEditor(
|
|||
if (subMod.Files.SetEquals(replacements))
|
||||
return;
|
||||
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
subMod.Files.SetTo(replacements);
|
||||
saveService.Save(saveType, new ModSaveGroup(subMod, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionFilesChanged, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionFilesChanged, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
}
|
||||
|
||||
/// <summary> Forces a file save of the given container's group. </summary>
|
||||
|
|
@ -181,7 +181,7 @@ public class ModGroupEditor(
|
|||
if (oldCount != subMod.Files.Count)
|
||||
{
|
||||
saveService.QueueSave(new ModSaveGroup(subMod, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionFilesAdded, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionFilesAdded, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,10 +191,10 @@ public class ModGroupEditor(
|
|||
if (subMod.FileSwaps.SetEquals(swaps))
|
||||
return;
|
||||
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
subMod.FileSwaps.SetTo(swaps);
|
||||
saveService.Save(saveType, new ModSaveGroup(subMod, config.ReplaceNonAsciiOnImport));
|
||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionSwapsChanged, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||
communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionSwapsChanged, (Mod)subMod.Mod, subMod.Group, null, subMod, -1));
|
||||
}
|
||||
|
||||
/// <summary> Verify that a new option group name is unique in this mod. </summary>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Luna;
|
||||
using Luna.Files;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Settings;
|
||||
using Penumbra.Mods.SubMods;
|
||||
|
|
@ -28,7 +28,7 @@ public abstract class ModOptionEditor<TGroup, TOption>(
|
|||
var group = CreateGroup(mod, newName, maxPriority);
|
||||
mod.Groups.Add(group);
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupAdded, mod, group, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupAdded, mod, group, null, null, -1));
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ public abstract class ModOptionEditor<TGroup, TOption>(
|
|||
return null;
|
||||
|
||||
SaveService.Save(saveType, new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionAdded, group.Mod, group, option, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionAdded, group.Mod, group, option, null, -1));
|
||||
return option;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ public abstract class ModOptionEditor<TGroup, TOption>(
|
|||
return null;
|
||||
|
||||
SaveService.QueueSave(new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionAdded, group.Mod, group, clonedOption, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionAdded, group.Mod, group, clonedOption, null, -1));
|
||||
return clonedOption;
|
||||
}
|
||||
|
||||
|
|
@ -95,10 +95,10 @@ public abstract class ModOptionEditor<TGroup, TOption>(
|
|||
var mod = option.Mod;
|
||||
var group = option.Group;
|
||||
var optionIdx = option.GetIndex();
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, mod, group, option, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PrepareChange, mod, group, option, null, -1));
|
||||
RemoveOption((TGroup)group, optionIdx);
|
||||
SaveService.QueueSave(new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionDeleted, mod, group, null, null, optionIdx);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionDeleted, mod, group, null, null, optionIdx));
|
||||
}
|
||||
|
||||
/// <summary> Move an option inside the given option group. </summary>
|
||||
|
|
@ -110,7 +110,7 @@ public abstract class ModOptionEditor<TGroup, TOption>(
|
|||
return;
|
||||
|
||||
SaveService.QueueSave(new ModSaveGroup(group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.OptionMoved, group.Mod, group, option, null, idx);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.OptionMoved, group.Mod, group, option, null, idx));
|
||||
}
|
||||
|
||||
protected abstract TGroup CreateGroup(Mod mod, string newName, ModPriority priority, SaveType saveType = SaveType.ImmediateSync);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Luna.Files;
|
||||
using Luna;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Settings;
|
||||
using Penumbra.Mods.SubMods;
|
||||
|
|
@ -16,7 +17,7 @@ public sealed class MultiModGroupEditor(CommunicatorService communicator, SaveSe
|
|||
var singleGroup = group.ConvertToSingle();
|
||||
group.Mod.Groups[idx] = singleGroup;
|
||||
SaveService.QueueSave(new ModSaveGroup(singleGroup, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupTypeChanged, singleGroup.Mod, singleGroup, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupTypeChanged, singleGroup.Mod, singleGroup, null, null, -1));
|
||||
}
|
||||
|
||||
/// <summary> Change the internal priority of the given option. </summary>
|
||||
|
|
@ -27,7 +28,7 @@ public sealed class MultiModGroupEditor(CommunicatorService communicator, SaveSe
|
|||
|
||||
option.Priority = newPriority;
|
||||
SaveService.QueueSave(new ModSaveGroup(option.Group, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.PriorityChanged, option.Mod, option.Group, option, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.PriorityChanged, option.Mod, option.Group, option, null, -1));
|
||||
}
|
||||
|
||||
protected override MultiModGroup CreateGroup(Mod mod, string newName, ModPriority priority, SaveType saveType = SaveType.ImmediateSync)
|
||||
|
|
@ -74,7 +75,7 @@ public sealed class MultiModGroupEditor(CommunicatorService communicator, SaveSe
|
|||
|
||||
protected override bool MoveOption(MultiModGroup group, int optionIdxFrom, int optionIdxTo)
|
||||
{
|
||||
if (!group.OptionData.Move(ref optionIdxFrom, ref optionIdxTo))
|
||||
if (!Extensions.Move(group.OptionData, ref optionIdxFrom, ref optionIdxTo))
|
||||
return false;
|
||||
|
||||
group.DefaultSettings = group.DefaultSettings.MoveBit(optionIdxFrom, optionIdxTo);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Luna.Files;
|
||||
using Luna;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Settings;
|
||||
using Penumbra.Mods.SubMods;
|
||||
|
|
@ -8,7 +9,7 @@ using Penumbra.Services;
|
|||
namespace Penumbra.Mods.Manager.OptionEditor;
|
||||
|
||||
public sealed class SingleModGroupEditor(CommunicatorService communicator, SaveService saveService, Configuration config)
|
||||
: ModOptionEditor<SingleModGroup, SingleSubMod>(communicator, saveService, config), Luna.IService
|
||||
: ModOptionEditor<SingleModGroup, SingleSubMod>(communicator, saveService, config), IService
|
||||
{
|
||||
public void ChangeToMulti(SingleModGroup group)
|
||||
{
|
||||
|
|
@ -16,7 +17,7 @@ public sealed class SingleModGroupEditor(CommunicatorService communicator, SaveS
|
|||
var multiGroup = group.ConvertToMulti();
|
||||
group.Mod.Groups[idx] = multiGroup;
|
||||
SaveService.QueueSave(new ModSaveGroup(multiGroup, Config.ReplaceNonAsciiOnImport));
|
||||
Communicator.ModOptionChanged.Invoke(ModOptionChangeType.GroupTypeChanged, multiGroup.Mod, multiGroup, null, null, -1);
|
||||
Communicator.ModOptionChanged.Invoke(new ModOptionChanged.Arguments(ModOptionChangeType.GroupTypeChanged, multiGroup.Mod, multiGroup, null, null, -1));
|
||||
}
|
||||
|
||||
protected override SingleModGroup CreateGroup(Mod mod, string newName, ModPriority priority, SaveType saveType = SaveType.ImmediateSync)
|
||||
|
|
@ -47,7 +48,7 @@ public sealed class SingleModGroupEditor(CommunicatorService communicator, SaveS
|
|||
|
||||
protected override bool MoveOption(SingleModGroup group, int optionIdxFrom, int optionIdxTo)
|
||||
{
|
||||
if (!group.OptionData.Move(ref optionIdxFrom, ref optionIdxTo))
|
||||
if (!Extensions.Move(group.OptionData, ref optionIdxFrom, ref optionIdxTo))
|
||||
return false;
|
||||
|
||||
group.DefaultSettings = group.DefaultSettings.MoveSingle(optionIdxFrom, optionIdxTo);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using OtterGui.Classes;
|
||||
using Penumbra.Api.Enums;
|
||||
using Luna;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.Collections.Manager;
|
||||
using Penumbra.Communication;
|
||||
|
|
@ -16,14 +15,14 @@ namespace Penumbra.Mods;
|
|||
/// <item>Parameter is the new selected mod </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
public class ModSelection : EventWrapper<Mod?, Mod?, ModSelection.Priority>
|
||||
public class ModSelection : EventBase<ModSelection.Arguments, ModSelection.Priority>
|
||||
{
|
||||
private readonly ActiveCollections _collections;
|
||||
private readonly EphemeralConfig _config;
|
||||
private readonly CommunicatorService _communicator;
|
||||
|
||||
public ModSelection(CommunicatorService communicator, ModManager mods, ActiveCollections collections, EphemeralConfig config)
|
||||
: base(nameof(ModSelection))
|
||||
public ModSelection(Logger log, CommunicatorService communicator, ModManager mods, ActiveCollections collections, EphemeralConfig config)
|
||||
: base(nameof(ModSelection), log)
|
||||
{
|
||||
_communicator = communicator;
|
||||
_collections = collections;
|
||||
|
|
@ -49,8 +48,8 @@ public class ModSelection : EventWrapper<Mod?, Mod?, ModSelection.Priority>
|
|||
|
||||
var oldMod = Mod;
|
||||
Mod = mod;
|
||||
OnCollectionChange(CollectionType.Current, null, _collections.Current, string.Empty);
|
||||
Invoke(oldMod, Mod);
|
||||
OnCollectionChange(new CollectionChange.Arguments(CollectionType.Current, null, _collections.Current, string.Empty));
|
||||
Invoke(new Arguments(oldMod, Mod));
|
||||
_config.LastModPath = mod?.ModPath.Name ?? string.Empty;
|
||||
_config.Save();
|
||||
}
|
||||
|
|
@ -62,21 +61,21 @@ public class ModSelection : EventWrapper<Mod?, Mod?, ModSelection.Priority>
|
|||
_communicator.ModSettingChanged.Unsubscribe(OnSettingChange);
|
||||
}
|
||||
|
||||
private void OnCollectionChange(CollectionType type, ModCollection? oldCollection, ModCollection? newCollection, string _2)
|
||||
private void OnCollectionChange(in CollectionChange.Arguments arguments)
|
||||
{
|
||||
if (type is CollectionType.Current && oldCollection != newCollection)
|
||||
if (arguments.Type is CollectionType.Current && arguments.OldCollection != arguments.NewCollection)
|
||||
UpdateSettings();
|
||||
}
|
||||
|
||||
private void OnSettingChange(ModCollection collection, ModSettingChange _1, Mod? mod, Setting _2, int _3, bool _4)
|
||||
private void OnSettingChange(in ModSettingChanged.Arguments arguments)
|
||||
{
|
||||
if (collection == _collections.Current && mod == Mod)
|
||||
if (arguments.Collection == _collections.Current && arguments.Mod == Mod)
|
||||
UpdateSettings();
|
||||
}
|
||||
|
||||
private void OnInheritanceChange(ModCollection collection, bool arg2)
|
||||
private void OnInheritanceChange(in CollectionInheritanceChanged.Arguments arguments)
|
||||
{
|
||||
if (collection == _collections.Current)
|
||||
if (arguments.Collection == _collections.Current)
|
||||
UpdateSettings();
|
||||
}
|
||||
|
||||
|
|
@ -105,4 +104,6 @@ public class ModSelection : EventWrapper<Mod?, Mod?, ModSelection.Priority>
|
|||
/// <seealso cref="Editor.ModMerger.OnSelectionChange"/>
|
||||
ModMerger = 0,
|
||||
}
|
||||
|
||||
public readonly record struct Arguments(Mod? OldSelection, Mod? NewSelection);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue