summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Serialisation/CrossplatformConverters
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/Serialisation/CrossplatformConverters')
-rw-r--r--src/SMAPI/Framework/Serialisation/CrossplatformConverters/ColorConverter.cs8
-rw-r--r--src/SMAPI/Framework/Serialisation/CrossplatformConverters/PointConverter.cs4
-rw-r--r--src/SMAPI/Framework/Serialisation/CrossplatformConverters/RectangleConverter.cs10
3 files changed, 11 insertions, 11 deletions
diff --git a/src/SMAPI/Framework/Serialisation/CrossplatformConverters/ColorConverter.cs b/src/SMAPI/Framework/Serialisation/CrossplatformConverters/ColorConverter.cs
index f4a2a26e..f1b2f04f 100644
--- a/src/SMAPI/Framework/Serialisation/CrossplatformConverters/ColorConverter.cs
+++ b/src/SMAPI/Framework/Serialisation/CrossplatformConverters/ColorConverter.cs
@@ -20,10 +20,10 @@ namespace StardewModdingAPI.Framework.Serialisation.CrossplatformConverters
/// <param name="path">The path to the current JSON node.</param>
protected override Color ReadObject(JObject obj, string path)
{
- int r = obj.Value<int>(nameof(Color.R));
- int g = obj.Value<int>(nameof(Color.G));
- int b = obj.Value<int>(nameof(Color.B));
- int a = obj.Value<int>(nameof(Color.A));
+ int r = obj.ValueIgnoreCase<int>(nameof(Color.R));
+ int g = obj.ValueIgnoreCase<int>(nameof(Color.G));
+ int b = obj.ValueIgnoreCase<int>(nameof(Color.B));
+ int a = obj.ValueIgnoreCase<int>(nameof(Color.A));
return new Color(r, g, b, a);
}
diff --git a/src/SMAPI/Framework/Serialisation/CrossplatformConverters/PointConverter.cs b/src/SMAPI/Framework/Serialisation/CrossplatformConverters/PointConverter.cs
index 84c70989..434b7ea5 100644
--- a/src/SMAPI/Framework/Serialisation/CrossplatformConverters/PointConverter.cs
+++ b/src/SMAPI/Framework/Serialisation/CrossplatformConverters/PointConverter.cs
@@ -20,8 +20,8 @@ namespace StardewModdingAPI.Framework.Serialisation.CrossplatformConverters
/// <param name="path">The path to the current JSON node.</param>
protected override Point ReadObject(JObject obj, string path)
{
- int x = obj.Value<int>(nameof(Point.X));
- int y = obj.Value<int>(nameof(Point.Y));
+ int x = obj.ValueIgnoreCase<int>(nameof(Point.X));
+ int y = obj.ValueIgnoreCase<int>(nameof(Point.Y));
return new Point(x, y);
}
diff --git a/src/SMAPI/Framework/Serialisation/CrossplatformConverters/RectangleConverter.cs b/src/SMAPI/Framework/Serialisation/CrossplatformConverters/RectangleConverter.cs
index b89551e3..62bc8637 100644
--- a/src/SMAPI/Framework/Serialisation/CrossplatformConverters/RectangleConverter.cs
+++ b/src/SMAPI/Framework/Serialisation/CrossplatformConverters/RectangleConverter.cs
@@ -21,10 +21,10 @@ namespace StardewModdingAPI.Framework.Serialisation.CrossplatformConverters
/// <param name="path">The path to the current JSON node.</param>
protected override Rectangle ReadObject(JObject obj, string path)
{
- int x = obj.Value<int>(nameof(Rectangle.X));
- int y = obj.Value<int>(nameof(Rectangle.Y));
- int width = obj.Value<int>(nameof(Rectangle.Width));
- int height = obj.Value<int>(nameof(Rectangle.Height));
+ int x = obj.ValueIgnoreCase<int>(nameof(Rectangle.X));
+ int y = obj.ValueIgnoreCase<int>(nameof(Rectangle.Y));
+ int width = obj.ValueIgnoreCase<int>(nameof(Rectangle.Width));
+ int height = obj.ValueIgnoreCase<int>(nameof(Rectangle.Height));
return new Rectangle(x, y, width, height);
}
@@ -36,7 +36,7 @@ namespace StardewModdingAPI.Framework.Serialisation.CrossplatformConverters
if (string.IsNullOrWhiteSpace(str))
return Rectangle.Empty;
- var match = Regex.Match(str, @"^\{X:(?<x>\d+) Y:(?<y>\d+) Width:(?<width>\d+) Height:(?<height>\d+)\}$");
+ var match = Regex.Match(str, @"^\{X:(?<x>\d+) Y:(?<y>\d+) Width:(?<width>\d+) Height:(?<height>\d+)\}$", RegexOptions.IgnoreCase);
if (!match.Success)
throw new SParseException($"Can't parse {typeof(Rectangle).Name} from invalid value '{str}' (path: {path}).");