Skip to content

Commit

Permalink
fix remaining color parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Dec 20, 2022
1 parent d2c328e commit 4d92721
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Project-Aurora/Project-Aurora/Utils/JSONUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Drawing;
using System.Text.RegularExpressions;
using System.Collections.ObjectModel;
using System.Linq;
using Aurora.Settings.Overrides.Logic;
using Newtonsoft.Json.Linq;

Expand Down Expand Up @@ -210,7 +211,14 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
return serializer.Deserialize(valueReader, type);
case JsonToken.String:
default:
return JsonConvert.DeserializeObject(value.ToString(), type);
var s = value.ToString();
if (objectType.FullName != typeof(Color).FullName && type?.FullName != typeof(Color).FullName)
return JsonConvert.DeserializeObject(s, type);
if (s.StartsWith("\""))
{
return JsonConvert.DeserializeObject(s, type);
}
return JsonConvert.DeserializeObject("\"" + value + "\"", type);
}
case JsonToken.Boolean:
return reader.Value;
Expand Down

0 comments on commit 4d92721

Please sign in to comment.