增加任意格式读取

This commit is contained in:
ww-rm
2025-03-24 01:57:49 +08:00
parent f885df5c67
commit 8f6cc9ff44

View File

@@ -111,6 +111,29 @@ namespace SpineViewer.Spine
root.WriteTo(writer);
}
/// <summary>
/// 读取骨骼文件
/// </summary>
public JsonObject Read(string path)
{
try
{
return ReadBinary(path);
}
catch
{
try
{
return ReadJson(path);
}
catch
{
// 都不行就报错
throw new InvalidDataException($"Unknown skeleton file format {path}");
}
}
}
/// <summary>
/// 转换到目标版本
/// </summary>