From fa9127a9cebc0143d149b0e4cbef66e6338978c9 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 14 Jan 2026 17:27:23 +0100 Subject: [PATCH] Core - Add McMeta.cs --- PckStudio.Core/IO/Java/McMeta.cs | 29 ++++++++++++++++++++++++++++ PckStudio.Core/IO/Java/McPack.cs | 18 +++++++++++++++++ PckStudio.Core/IO/Java/McPackmeta.cs | 25 ------------------------ PckStudio.Core/PckStudio.Core.csproj | 3 ++- 4 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 PckStudio.Core/IO/Java/McMeta.cs create mode 100644 PckStudio.Core/IO/Java/McPack.cs delete mode 100644 PckStudio.Core/IO/Java/McPackmeta.cs diff --git a/PckStudio.Core/IO/Java/McMeta.cs b/PckStudio.Core/IO/Java/McMeta.cs new file mode 100644 index 00000000..1382b9ad --- /dev/null +++ b/PckStudio.Core/IO/Java/McMeta.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; + +namespace PckStudio.Core.IO.Java +{ + public class McMeta : Dictionary + { + private McMeta(Dictionary type) : base(type) + { + } + + public bool Contains(string name) => ContainsKey(name); + + public static McMeta LoadMcMeta(string mcMetaJson) + { + JObject a = JObject.Parse(mcMetaJson); + Dictionary types = new Dictionary(); + foreach (KeyValuePair item in a) + { + types.Add(item.Key, item.Value.ToObject()); + } + return new McMeta(types); + } + } +} diff --git a/PckStudio.Core/IO/Java/McPack.cs b/PckStudio.Core/IO/Java/McPack.cs new file mode 100644 index 00000000..9fbf987a --- /dev/null +++ b/PckStudio.Core/IO/Java/McPack.cs @@ -0,0 +1,18 @@ +using System.Drawing; +using Newtonsoft.Json; + +namespace PckStudio.Core.IO.Java +{ + public struct McPack + { + [JsonIgnore] + public Image Icon; + + [JsonProperty("pack_format")] + public int Format; + + [JsonProperty("description")] + public string Description; + } +} + diff --git a/PckStudio.Core/IO/Java/McPackmeta.cs b/PckStudio.Core/IO/Java/McPackmeta.cs deleted file mode 100644 index 5690033e..00000000 --- a/PckStudio.Core/IO/Java/McPackmeta.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Drawing; -using Newtonsoft.Json; - -namespace PckStudio.Core.IO.Java -{ - public struct McPackmeta - { - [JsonProperty("pack")] - public McPack Pack; - public struct McPack - { - [JsonIgnore] - public Image Icon; - - [JsonIgnore] - public int Format => _format; - - [JsonProperty("description")] - public string Description; - - [JsonProperty("pack_format")] - private int _format; - } - } -} diff --git a/PckStudio.Core/PckStudio.Core.csproj b/PckStudio.Core/PckStudio.Core.csproj index 03b2fee8..97a56674 100644 --- a/PckStudio.Core/PckStudio.Core.csproj +++ b/PckStudio.Core/PckStudio.Core.csproj @@ -59,12 +59,13 @@ + - +