[unity] Fixed json vs binary file detection.

This commit is contained in:
Harald Csaszar 2021-09-29 21:10:58 +02:00
parent 39dfca8263
commit 8ea166b331

View File

@ -173,11 +173,16 @@ namespace Spine.Unity {
int i = 0;
if (content.Length >= 3 && content[0] == 0xEF && content[1] == 0xBB && content[2] == 0xBF) // skip potential BOM
i = 3;
bool openingBraceFound = false;
for (; i < numCharsToCheck; ++i) {
char c = (char)content[i];
if (char.IsWhiteSpace(c))
continue;
return c == '{';
if (!openingBraceFound) {
if (c == '{') openingBraceFound = true;
else return false;
} else
return c == '"';
}
return true;
}