diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs index c2fbb353b..a4d596cd0 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs @@ -96,8 +96,7 @@ namespace Spine.Unity { if (hasBinaryExtension) { problemDescription = string.Format("Failed to read '{0}'. Extension is '.skel.bytes' but content looks like a '.json' file.\n" + "Did you choose the wrong extension upon export?\n", asset.name); - } - else { + } else { problemDescription = string.Format("Failed to read '{0}'. Extension is '.json' but content looks like binary 'skel.bytes' file.\n" + "Did you choose the wrong extension upon export?\n", asset.name); } @@ -110,19 +109,16 @@ namespace Spine.Unity { using (var memStream = new MemoryStream(asset.bytes)) { fileVersion.rawVersion = SkeletonBinary.GetVersionString(memStream); } - } - catch (System.Exception e) { + } catch (System.Exception e) { problemDescription = string.Format("Failed to read '{0}'. It is likely not a binary Spine SkeletonData file.\n{1}", asset.name, e); isSpineSkeletonData = false; return null; } - } - else { + } else { Match match = jsonVersionRegex.Match(asset.text); if (match != null) { fileVersion.rawVersion = match.Groups[1].Value; - } - else { + } else { object obj = Json.Deserialize(new StringReader(asset.text)); if (obj == null) { problemDescription = string.Format("'{0}' is not valid JSON.", asset.name); @@ -156,8 +152,7 @@ namespace Spine.Unity { try { fileVersion.version = new[]{ int.Parse(versionSplit[0], CultureInfo.InvariantCulture), int.Parse(versionSplit[1], CultureInfo.InvariantCulture) }; - } - catch (System.Exception e) { + } catch (System.Exception e) { problemDescription = string.Format("Failed to read version info at skeleton '{0}'. It is likely not a valid Spine SkeletonData file.\n{1}", asset.name, e); isSpineSkeletonData = false; return null; @@ -179,9 +174,11 @@ namespace Spine.Unity { if (char.IsWhiteSpace(c)) continue; if (!openingBraceFound) { - if (c == '{') openingBraceFound = true; + if (c == '{' || c == '[') openingBraceFound = true; else return false; - } else + } else if (c == '{' || c == '[' || c == ']' || c == '}' || c == ',') + continue; + else return c == '"'; } return true;