Use system.text.json to parse typetree

well, it's still slower than some more suitable libs for such task, but stable and with minimal code changes (and has net472 support, yeah)
This commit is contained in:
VaDiM
2024-04-13 01:01:23 +03:00
parent a3f4c7a029
commit 2c860f004b
8 changed files with 115 additions and 59 deletions

View File

@@ -1,9 +1,9 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
namespace AssetStudio
{
@@ -1018,9 +1018,9 @@ namespace AssetStudio
public AnimationClip() { }
public AnimationClip(ObjectReader reader, IDictionary typeDict) : base(reader)
public AnimationClip(ObjectReader reader, IDictionary typeDict, JsonSerializerOptions jsonOptions) : base(reader)
{
var parsedAnimClip = JsonConvert.DeserializeObject<AnimationClip>(JsonConvert.SerializeObject(typeDict));
var parsedAnimClip = JsonSerializer.Deserialize<AnimationClip>(JsonSerializer.SerializeToUtf8Bytes(typeDict, jsonOptions), jsonOptions);
m_AnimationType = parsedAnimClip.m_AnimationType;
m_Legacy = parsedAnimClip.m_Legacy;
m_Compressed = parsedAnimClip.m_Compressed;