Added Profile.GetProfileList, Profile.EnableByUniqueId, Profile.DisableByUniqueId IPC endpoints
Co-authored-by: Limiana <5073202+Limiana@users.noreply.github.com>
This commit is contained in:
@@ -18,7 +18,7 @@ public partial class CustomizePlusIpc
|
||||
/// When there are non-breaking changes only second number is bumped up.
|
||||
/// In general clients should not try to use IPC if they encounter unexpected Breaking version.
|
||||
/// </summary>
|
||||
[EzIPC($"General.{nameof(GetApiVersion)}")]
|
||||
[EzIPC($"General.GetApiVersion")]
|
||||
private (int, int) GetApiVersion()
|
||||
{
|
||||
return _apiVersion;
|
||||
@@ -29,7 +29,7 @@ public partial class CustomizePlusIpc
|
||||
/// This only indicates that no fatal errors occured in Customize+.
|
||||
/// This will still be true if, for example, user turns off Customize+ in its settings.
|
||||
/// </summary>
|
||||
[EzIPC($"General.{nameof(IsValid)}")]
|
||||
[EzIPC($"General.IsValid")]
|
||||
private bool IsValid()
|
||||
{
|
||||
return !IPCFailed &&
|
||||
|
||||
@@ -1,12 +1,44 @@
|
||||
using System;
|
||||
using CustomizePlus.Profiles.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ECommons.EzIpcManager;
|
||||
|
||||
using IPCProfileDataTuple = (System.Guid UniqueId, string Name, string CharacterName, bool IsEnabled);
|
||||
|
||||
namespace CustomizePlus.Api;
|
||||
|
||||
public partial class CustomizePlusIpc
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve list of all user profiles
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[EzIPC($"Profile.GetProfileList")]
|
||||
private IList<IPCProfileDataTuple> GetProfileList()
|
||||
{
|
||||
return _profileManager.Profiles
|
||||
.Where(x => x.ProfileType == ProfileType.Normal)
|
||||
.Select(x => (x.UniqueId, x.Name.Text, x.CharacterName.Text, x.Enabled))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable profile using its Unique ID
|
||||
/// </summary>
|
||||
/// <param name="uniqueId"></param>
|
||||
[EzIPC($"Profile.EnableByUniqueId")]
|
||||
private void EnableProfileByUniqueId(Guid uniqueId)
|
||||
{
|
||||
_profileManager.SetEnabled(uniqueId, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable profile using its Unique ID
|
||||
/// </summary>
|
||||
[EzIPC($"Profile.DisableByUniqueId")]
|
||||
private void DisableProfileByUniqueId(Guid uniqueId)
|
||||
{
|
||||
_profileManager.SetEnabled(uniqueId, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CustomizePlus.Core.Services;
|
||||
using CustomizePlus.Profiles;
|
||||
using Dalamud.Plugin;
|
||||
using ECommons.EzIpcManager;
|
||||
using OtterGui.Log;
|
||||
@@ -11,6 +12,7 @@ public partial class CustomizePlusIpc
|
||||
private readonly DalamudPluginInterface _pluginInterface;
|
||||
private readonly Logger _logger;
|
||||
private readonly HookingService _hookingService;
|
||||
private readonly ProfileManager _profileManager;
|
||||
|
||||
/// <summary>
|
||||
/// Shows if IPC failed to initialize or any other unrecoverable fatal error occured.
|
||||
@@ -20,11 +22,13 @@ public partial class CustomizePlusIpc
|
||||
public CustomizePlusIpc(
|
||||
DalamudPluginInterface pluginInterface,
|
||||
Logger logger,
|
||||
HookingService hookingService)
|
||||
HookingService hookingService,
|
||||
ProfileManager profileManager)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
_logger = logger;
|
||||
_hookingService = hookingService;
|
||||
_profileManager = profileManager;
|
||||
|
||||
EzIPC.Init(this, "CustomizePlus");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user