From 83e42ceb30a7ba93882a10aab822a625ae943db6 Mon Sep 17 00:00:00 2001 From: aniachan Date: Fri, 18 Apr 2025 19:26:55 +0000 Subject: [PATCH 1/2] temporary profile patch --- CustomizePlus/Api/CustomizePlusIpc.General.cs | 2 +- CustomizePlus/Api/CustomizePlusIpc.Profile.cs | 2 +- .../Api/CustomizePlusIpc.Template.cs | 73 +++++++++++++++++++ CustomizePlus/Api/CustomizePlusIpc.cs | 10 ++- CustomizePlus/CustomizePlus.csproj | 2 +- CustomizePlus/CustomizePlus.json | 6 +- CustomizePlus/Profiles/ProfileManager.cs | 2 +- README.md | 4 +- repo.json | 18 ++--- 9 files changed, 98 insertions(+), 21 deletions(-) create mode 100644 CustomizePlus/Api/CustomizePlusIpc.Template.cs diff --git a/CustomizePlus/Api/CustomizePlusIpc.General.cs b/CustomizePlus/Api/CustomizePlusIpc.General.cs index 8d6cbfe..59d816a 100644 --- a/CustomizePlus/Api/CustomizePlusIpc.General.cs +++ b/CustomizePlus/Api/CustomizePlusIpc.General.cs @@ -4,7 +4,7 @@ namespace CustomizePlus.Api; public partial class CustomizePlusIpc { - private readonly (int Breaking, int Feature) _apiVersion = (6, 4); + private readonly (int Breaking, int Feature) _apiVersion = (6, 104); /// /// When there are breaking changes the first number is bumped up and second one is reset. diff --git a/CustomizePlus/Api/CustomizePlusIpc.Profile.cs b/CustomizePlus/Api/CustomizePlusIpc.Profile.cs index 7593134..7f2b1e4 100644 --- a/CustomizePlus/Api/CustomizePlusIpc.Profile.cs +++ b/CustomizePlus/Api/CustomizePlusIpc.Profile.cs @@ -78,7 +78,7 @@ private IList GetProfileList() if (uniqueId == Guid.Empty) return ((int)ErrorCode.ProfileNotFound, null); - var profile = _profileManager.Profiles.Where(x => x.UniqueId == uniqueId && !x.IsTemporary).FirstOrDefault(); //todo: move into profile manager + var profile = _profileManager.Profiles.Where(x => x.UniqueId == uniqueId /*&& !x.IsTemporary*/).FirstOrDefault(); //todo: move into profile manager if (profile == null) return ((int)ErrorCode.ProfileNotFound, null); diff --git a/CustomizePlus/Api/CustomizePlusIpc.Template.cs b/CustomizePlus/Api/CustomizePlusIpc.Template.cs new file mode 100644 index 0000000..a1a510f --- /dev/null +++ b/CustomizePlus/Api/CustomizePlusIpc.Template.cs @@ -0,0 +1,73 @@ +using CustomizePlus.Api.Enums; +using ECommonsLite.EzIpcManager; +using CustomizePlus.Core.Helpers; +using System; +using CustomizePlus.Templates.Data; +using Newtonsoft.Json; +using CustomizePlus.Configuration.Data.Version2; +using CustomizePlus.Configuration.Data.Version3; +using CustomizePlus.Configuration.Helpers; +using System.Buffers.Text; +using FFXIVClientStructs.FFXIV.Application.Network.WorkDefinitions; + +namespace CustomizePlus.Api; +public partial class CustomizePlusIpc +{ + /// + /// Imports a new template from a base64 string provided over IPC. + /// + [EzIPC("Template.Import")] + private int ImportProfile(string templateData, string name) + { + Template template = null; + try + { + string json = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(templateData)); + template = JsonConvert.DeserializeObject