From 2a7885273abac860a79e0fa3b8ee61cb1a0a4cc3 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:33:21 +0100 Subject: [PATCH] Core - Move PointJsonConverter class into PointJsonConverter.cs --- PckStudio.Core/IO/Java/PointJsonConverter.cs | 24 ++++++++++++++++++++ PckStudio.Core/IO/Java/SizeJsonConverter.cs | 17 -------------- PckStudio.Core/PckStudio.Core.csproj | 1 + 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 PckStudio.Core/IO/Java/PointJsonConverter.cs diff --git a/PckStudio.Core/IO/Java/PointJsonConverter.cs b/PckStudio.Core/IO/Java/PointJsonConverter.cs new file mode 100644 index 00000000..5b910d4f --- /dev/null +++ b/PckStudio.Core/IO/Java/PointJsonConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Drawing; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace PckStudio.Core.IO.Java +{ + public class PointJsonConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, Point value, JsonSerializer serializer) + { + JObject jo = new JObject(); + jo.Add("x", value.X); + jo.Add("y", value.Y); + jo.WriteTo(writer); + } + + public override Point ReadJson(JsonReader reader, Type objectType, Point existingValue, bool hasExistingValue, JsonSerializer serializer) + { + JObject jo = JObject.Load(reader); + return new Point((int)(jo["x"] ?? 0), (int)(jo["y"] ?? 0)); + } + } +} \ No newline at end of file diff --git a/PckStudio.Core/IO/Java/SizeJsonConverter.cs b/PckStudio.Core/IO/Java/SizeJsonConverter.cs index 0e2e3285..a103fcb9 100644 --- a/PckStudio.Core/IO/Java/SizeJsonConverter.cs +++ b/PckStudio.Core/IO/Java/SizeJsonConverter.cs @@ -21,21 +21,4 @@ namespace PckStudio.Core.IO.Java return new Size((int)(jo["width"] ?? 0), (int)(jo["height"] ?? 0)); } } - - public class PointJsonConverter : JsonConverter - { - public override void WriteJson(JsonWriter writer, Point value, JsonSerializer serializer) - { - JObject jo = new JObject(); - jo.Add("x", value.X); - jo.Add("y", value.Y); - jo.WriteTo(writer); - } - - public override Point ReadJson(JsonReader reader, Type objectType, Point existingValue, bool hasExistingValue, JsonSerializer serializer) - { - JObject jo = JObject.Load(reader); - return new Point((int)(jo["x"] ?? 0), (int)(jo["y"] ?? 0)); - } - } } \ No newline at end of file diff --git a/PckStudio.Core/PckStudio.Core.csproj b/PckStudio.Core/PckStudio.Core.csproj index acdaee02..8461a45b 100644 --- a/PckStudio.Core/PckStudio.Core.csproj +++ b/PckStudio.Core/PckStudio.Core.csproj @@ -60,6 +60,7 @@ +