Browse Source

Fixed type converters to acutlaly use the utilities i made for them (sigh)

4.0.0-beta
Anairkoen Schno 5 years ago
parent
commit
e44b6a535a
2 changed files with 4 additions and 4 deletions
  1. +3
    -3
      IPA.Loader/Config/Stores/Converters.cs
  2. +1
    -1
      IPA.Loader/Utilities/AlmostVersion.cs

+ 3
- 3
IPA.Loader/Config/Stores/Converters.cs View File

@ -192,7 +192,7 @@ namespace IPA.Config.Stores.Converters
internal class LongConverter : ValueConverter<long>
{
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<ulong>
{
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<decimal>
{
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);
}


+ 1
- 1
IPA.Loader/Utilities/AlmostVersion.cs View File

@ -216,7 +216,7 @@ namespace IPA.Utilities
}
/// <summary>
/// The opposite of <see cref="operator ==(AlmostVersion, AlmostVersion)"/>. Equivalent to <code>!(l == r)</code>.
/// The opposite of <see cref="operator ==(AlmostVersion, AlmostVersion)"/>. Equivalent to <c>!(l == r)</c>.
/// </summary>
/// <param name="l">the first value to compare</param>
/// <param name="r">the second value to compare</param>


Loading…
Cancel
Save