mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-05 18:35:03 +00:00
Creates a method of parsing and creating Bedrock JSON Sound files
This commit is contained in:
26
MinecraftUSkinEditor/Classes/IO/Sounds/SoundIO.cs
Normal file
26
MinecraftUSkinEditor/Classes/IO/Sounds/SoundIO.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PckStudio.Classes.IO.Sounds
|
||||
{
|
||||
public class SoundIO
|
||||
{
|
||||
public Dictionary<string, Type> Read(string Filepath)
|
||||
{
|
||||
var jObj = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(File.ReadAllText(Filepath));
|
||||
var dict = JsonConvert.DeserializeObject<Dictionary<string, Type>>(jObj.ToString());
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
public string Serialize(Dictionary<string, Type> input)
|
||||
{
|
||||
return JsonConvert.SerializeObject(input, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
MinecraftUSkinEditor/Classes/IO/Sounds/Sounds.cs
Normal file
21
MinecraftUSkinEditor/Classes/IO/Sounds/Sounds.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PckStudio.Classes.IO.Sounds
|
||||
{
|
||||
public class Type
|
||||
{
|
||||
public bool replace { get; set; }
|
||||
public List<Sound> sounds = new List<Sound>();
|
||||
}
|
||||
|
||||
public class Sound
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string type { get; set; }
|
||||
public bool stream { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -149,6 +149,8 @@
|
||||
<Compile Include="Classes\IO\PCK\PCKAudioFileWriter.cs" />
|
||||
<Compile Include="Classes\IO\COL\COLFileReader.cs" />
|
||||
<Compile Include="Classes\IO\COL\COLFileWriter.cs" />
|
||||
<Compile Include="Classes\IO\Sounds\SoundIO.cs" />
|
||||
<Compile Include="Classes\IO\Sounds\Sounds.cs" />
|
||||
<Compile Include="Classes\Utils\SkinANIM.cs" />
|
||||
<Compile Include="Classes\FileTypes\PCKProperties.cs" />
|
||||
<Compile Include="Classes\FileTypes\PCKFile.cs" />
|
||||
|
||||
Reference in New Issue
Block a user