mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-04 07:45:50 +00:00
Core - Add McMeta.cs
This commit is contained in:
29
PckStudio.Core/IO/Java/McMeta.cs
Normal file
29
PckStudio.Core/IO/Java/McMeta.cs
Normal file
@@ -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<string, JObject>
|
||||
{
|
||||
private McMeta(Dictionary<string, JObject> type) : base(type)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Contains(string name) => ContainsKey(name);
|
||||
|
||||
public static McMeta LoadMcMeta(string mcMetaJson)
|
||||
{
|
||||
JObject a = JObject.Parse(mcMetaJson);
|
||||
Dictionary<string, JObject> types = new Dictionary<string, JObject>();
|
||||
foreach (KeyValuePair<string, JToken> item in a)
|
||||
{
|
||||
types.Add(item.Key, item.Value.ToObject<JObject>());
|
||||
}
|
||||
return new McMeta(types);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
PckStudio.Core/IO/Java/McPack.cs
Normal file
18
PckStudio.Core/IO/Java/McPack.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,12 +59,13 @@
|
||||
<Compile Include="IO\Java\ImportStatusReport.cs" />
|
||||
<Compile Include="IO\Java\IVersion.cs" />
|
||||
<Compile Include="IO\Java\JavaConstants.cs" />
|
||||
<Compile Include="IO\Java\McMeta.cs" />
|
||||
<Compile Include="IO\Java\SingleVersion.cs" />
|
||||
<Compile Include="IO\Java\SizeJsonConverter.cs" />
|
||||
<Compile Include="IO\Java\SpecificVerions.cs" />
|
||||
<Compile Include="IO\Java\VersionRange.cs" />
|
||||
<Compile Include="LCEGameVersion.cs" />
|
||||
<Compile Include="IO\Java\McPackmeta.cs" />
|
||||
<Compile Include="IO\Java\McPack.cs" />
|
||||
<Compile Include="IO\Java\ResourcePackImporter.cs" />
|
||||
<Compile Include="Animation.cs" />
|
||||
<Compile Include="App\AppLanguage.cs" />
|
||||
|
||||
Reference in New Issue
Block a user