From 9c0acf7302215b51e2cc88c29909a97bf25fe716 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Thu, 11 Sep 2025 23:17:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8A=A5=E9=94=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SpineWrappers/V21/SpineObjectData21.cs | 20 +++++++++++++----- .../SpineWrappers/V34/SpineObjectData34.cs | 20 +++++++++++++----- .../SpineWrappers/V35/SpineObjectData35.cs | 20 +++++++++++++----- .../SpineWrappers/V36/SpineObjectData36.cs | 20 +++++++++++++----- .../SpineWrappers/V37/SpineObjectData37.cs | 20 +++++++++++++----- .../SpineWrappers/V38/SpineObjectData38.cs | 20 +++++++++++++----- .../SpineWrappers/V40/SpineObjectData40.cs | 21 +++++++++++++------ .../SpineWrappers/V41/SpineObjectData41.cs | 21 +++++++++++++------ .../SpineWrappers/V42/SpineObjectData42.cs | 21 +++++++++++++------ Spine/SpineObject.cs | 3 ++- Spine/SpineWrappers/SpineObjectData.cs | 3 +++ 11 files changed, 140 insertions(+), 49 deletions(-) diff --git a/Spine/Implementations/SpineWrappers/V21/SpineObjectData21.cs b/Spine/Implementations/SpineWrappers/V21/SpineObjectData21.cs index 4a7c9a1..f14525b 100644 --- a/Spine/Implementations/SpineWrappers/V21/SpineObjectData21.cs +++ b/Spine/Implementations/SpineWrappers/V21/SpineObjectData21.cs @@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V21 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } try { @@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V21 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V21 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V21 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V34/SpineObjectData34.cs b/Spine/Implementations/SpineWrappers/V34/SpineObjectData34.cs index 8d19c1d..729f65b 100644 --- a/Spine/Implementations/SpineWrappers/V34/SpineObjectData34.cs +++ b/Spine/Implementations/SpineWrappers/V34/SpineObjectData34.cs @@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V34 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } try { @@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V34 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V34 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V34 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V35/SpineObjectData35.cs b/Spine/Implementations/SpineWrappers/V35/SpineObjectData35.cs index 011dda8..2d19ea9 100644 --- a/Spine/Implementations/SpineWrappers/V35/SpineObjectData35.cs +++ b/Spine/Implementations/SpineWrappers/V35/SpineObjectData35.cs @@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V35 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } try { @@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V35 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V35 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V35 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V36/SpineObjectData36.cs b/Spine/Implementations/SpineWrappers/V36/SpineObjectData36.cs index a389679..67037a3 100644 --- a/Spine/Implementations/SpineWrappers/V36/SpineObjectData36.cs +++ b/Spine/Implementations/SpineWrappers/V36/SpineObjectData36.cs @@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V36 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } try { @@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V36 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V36 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V36 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V37/SpineObjectData37.cs b/Spine/Implementations/SpineWrappers/V37/SpineObjectData37.cs index 470eec7..3851834 100644 --- a/Spine/Implementations/SpineWrappers/V37/SpineObjectData37.cs +++ b/Spine/Implementations/SpineWrappers/V37/SpineObjectData37.cs @@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V37 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } try { @@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V37 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V37 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V37 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V38/SpineObjectData38.cs b/Spine/Implementations/SpineWrappers/V38/SpineObjectData38.cs index 0204041..45265e8 100644 --- a/Spine/Implementations/SpineWrappers/V38/SpineObjectData38.cs +++ b/Spine/Implementations/SpineWrappers/V38/SpineObjectData38.cs @@ -31,8 +31,15 @@ namespace Spine.Implementations.SpineWrappers.V38 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } try { @@ -42,8 +49,9 @@ namespace Spine.Implementations.SpineWrappers.V38 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -53,8 +61,9 @@ namespace Spine.Implementations.SpineWrappers.V38 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -62,7 +71,8 @@ namespace Spine.Implementations.SpineWrappers.V38 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V40/SpineObjectData40.cs b/Spine/Implementations/SpineWrappers/V40/SpineObjectData40.cs index bc035d7..6014619 100644 --- a/Spine/Implementations/SpineWrappers/V40/SpineObjectData40.cs +++ b/Spine/Implementations/SpineWrappers/V40/SpineObjectData40.cs @@ -30,10 +30,16 @@ namespace Spine.Implementations.SpineWrappers.V40 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } - // 加载 skel try { if (Utf8Validator.IsUtf8(skelPath)) @@ -42,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V40 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -53,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V40 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -62,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V40 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V41/SpineObjectData41.cs b/Spine/Implementations/SpineWrappers/V41/SpineObjectData41.cs index 18ed63b..259655f 100644 --- a/Spine/Implementations/SpineWrappers/V41/SpineObjectData41.cs +++ b/Spine/Implementations/SpineWrappers/V41/SpineObjectData41.cs @@ -30,10 +30,16 @@ namespace Spine.Implementations.SpineWrappers.V41 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } - // 加载 skel try { if (Utf8Validator.IsUtf8(skelPath)) @@ -42,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V41 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -53,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V41 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -62,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V41 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/Implementations/SpineWrappers/V42/SpineObjectData42.cs b/Spine/Implementations/SpineWrappers/V42/SpineObjectData42.cs index 83a7365..fb1d19f 100644 --- a/Spine/Implementations/SpineWrappers/V42/SpineObjectData42.cs +++ b/Spine/Implementations/SpineWrappers/V42/SpineObjectData42.cs @@ -30,10 +30,16 @@ namespace Spine.Implementations.SpineWrappers.V42 : base(skelPath, atlasPath, textureLoader) { // 加载 atlas - try { _atlas = new Atlas(atlasPath, textureLoader); } - catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } + try + { + _atlas = new Atlas(atlasPath, textureLoader); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load atlas '{atlasPath}'"); + } - // 加载 skel try { if (Utf8Validator.IsUtf8(skelPath)) @@ -42,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V42 { _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } } @@ -53,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V42 { _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); } } @@ -62,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V42 catch (Exception ex) { _atlas.Dispose(); - throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); + _logger.Trace(ex.ToString()); + throw new InvalidDataException($"Failed to load skeleton file {skelPath}"); } // 加载动画数据 diff --git a/Spine/SpineObject.cs b/Spine/SpineObject.cs index fe8edb9..7cfda72 100644 --- a/Spine/SpineObject.cs +++ b/Spine/SpineObject.cs @@ -115,8 +115,9 @@ namespace Spine { _data = SpineObjectData.New(Version, skelPath, atlasPath, textureLoader); } - catch + catch (Exception ex) { + _logger.Trace(ex.ToString()); throw new InvalidDataException($"Failed to load spine with version '{version}'"); } } diff --git a/Spine/SpineWrappers/SpineObjectData.cs b/Spine/SpineWrappers/SpineObjectData.cs index 0e8f0dc..7017d3c 100644 --- a/Spine/SpineWrappers/SpineObjectData.cs +++ b/Spine/SpineWrappers/SpineObjectData.cs @@ -5,6 +5,7 @@ using System.Collections.Immutable; using System.Linq; using System.Text; using System.Threading.Tasks; +using NLog; using Spine.SpineWrappers.Attachments; namespace Spine.SpineWrappers @@ -17,6 +18,8 @@ namespace Spine.SpineWrappers ISpineObjectData, IDisposable { + protected static readonly Logger _logger = LogManager.GetCurrentClassLogger(); + /// /// 构建版本对象 ///