Optimize IPC jsons

This commit is contained in:
RisaDev
2025-02-27 19:27:45 +03:00
parent 57a5e40d8f
commit daca4df4d3
2 changed files with 6 additions and 2 deletions

View File

@@ -23,6 +23,8 @@ namespace CustomizePlus.Api;
public partial class CustomizePlusIpc
{
private static JsonSerializerSettings _ipcProfileSerializerSettings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore };
/// <summary>
/// Triggered when changes in currently active profiles are detected. (like changing active profile or making any changes to it)
/// Not triggered if any changes happen due to character no longer existing.
@@ -88,7 +90,7 @@ public partial class CustomizePlusIpc
try
{
return ((int)ErrorCode.Success, JsonConvert.SerializeObject(convertedProfile));
return ((int)ErrorCode.Success, JsonConvert.SerializeObject(convertedProfile, _ipcProfileSerializerSettings));
}
catch (Exception ex)
{

View File

@@ -27,6 +27,8 @@ public class IPCTestTab //: IDisposable
{
private const string _ownedTesProfile = "{\"Bones\":{\"n_root\":{\"Translation\":{\"X\":0.0,\"Y\":0.0,\"Z\":0.0},\"Rotation\":{\"X\":0.0,\"Y\":0.0,\"Z\":0.0},\"Scaling\":{\"X\":2.0,\"Y\":2.0,\"Z\":2.0}}}}";
private static JsonSerializerSettings _ipcProfileSerializerSettings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore };
private readonly IObjectTable _objectTable;
private readonly ProfileManager _profileManager;
private readonly PopupSystem _popupSystem;
@@ -186,7 +188,7 @@ public class IPCTestTab //: IDisposable
if (profile == null)
return;
_rememberedProfileJson = JsonConvert.SerializeObject(IPCCharacterProfile.FromFullProfile(profile));
_rememberedProfileJson = JsonConvert.SerializeObject(IPCCharacterProfile.FromFullProfile(profile), _ipcProfileSerializerSettings);
_popupSystem.ShowPopup(PopupSystem.Messages.IPCProfileRemembered);
}