From 8f6cc9ff444bdaa2ab54ec395c970cdf85286132 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Mon, 24 Mar 2025 01:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=BB=E6=84=8F=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpineViewer/Spine/SkeletonConverter.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/SpineViewer/Spine/SkeletonConverter.cs b/SpineViewer/Spine/SkeletonConverter.cs index 23d9767..c470dbb 100644 --- a/SpineViewer/Spine/SkeletonConverter.cs +++ b/SpineViewer/Spine/SkeletonConverter.cs @@ -111,6 +111,29 @@ namespace SpineViewer.Spine root.WriteTo(writer); } + /// + /// 读取骨骼文件 + /// + public JsonObject Read(string path) + { + try + { + return ReadBinary(path); + } + catch + { + try + { + return ReadJson(path); + } + catch + { + // 都不行就报错 + throw new InvalidDataException($"Unknown skeleton file format {path}"); + } + } + } + /// /// 转换到目标版本 ///