From e44b6a535a7ea927f230fcbd7e6e7874f8b04b61 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 15 Dec 2019 01:35:38 -0600 Subject: [PATCH] Fixed type converters to acutlaly use the utilities i made for them (sigh) --- IPA.Loader/Config/Stores/Converters.cs | 6 +++--- IPA.Loader/Utilities/AlmostVersion.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IPA.Loader/Config/Stores/Converters.cs b/IPA.Loader/Config/Stores/Converters.cs index 1d092e6a..605bd08d 100644 --- a/IPA.Loader/Config/Stores/Converters.cs +++ b/IPA.Loader/Config/Stores/Converters.cs @@ -192,7 +192,7 @@ namespace IPA.Config.Stores.Converters internal class LongConverter : ValueConverter { public override long FromValue(Value value, object parent) - => (value as Integer)?.Value ?? (long)(value as FloatingPoint).Value; + => Converter.IntValue(value) ?? throw new ArgumentException("Value not a numeric value", nameof(value)); public override Value ToValue(long obj, object parent) => Value.From(obj); @@ -201,7 +201,7 @@ namespace IPA.Config.Stores.Converters internal class ULongConverter : ValueConverter { public override ulong FromValue(Value value, object parent) - => (ulong)((value as FloatingPoint)?.Value ?? (value as Integer).Value); + => (ulong)(Converter.FloatValue(value) ?? throw new ArgumentException("Value not a numeric value", nameof(value))); public override Value ToValue(ulong obj, object parent) => Value.From(obj); @@ -276,7 +276,7 @@ namespace IPA.Config.Stores.Converters internal class DecimalConverter : ValueConverter { public override decimal FromValue(Value value, object parent) - => (value as FloatingPoint)?.Value ?? (value as Integer).Value; + => Converter.FloatValue(value) ?? throw new ArgumentException("Value not a numeric value", nameof(value)); public override Value ToValue(decimal obj, object parent) => Value.From(obj); } diff --git a/IPA.Loader/Utilities/AlmostVersion.cs b/IPA.Loader/Utilities/AlmostVersion.cs index 6aad7157..c23f0ba9 100644 --- a/IPA.Loader/Utilities/AlmostVersion.cs +++ b/IPA.Loader/Utilities/AlmostVersion.cs @@ -216,7 +216,7 @@ namespace IPA.Utilities } /// - /// The opposite of . Equivalent to !(l == r). + /// The opposite of . Equivalent to !(l == r). /// /// the first value to compare /// the second value to compare