minor fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Pilz.Configuration;
|
namespace Pilz.Configuration;
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ public class SettingsValueOption<T> : ISettingsValueOptionValueAccessor where T
|
|||||||
|
|
||||||
public SettingsValueOption(T value)
|
public SettingsValueOption(T value)
|
||||||
{
|
{
|
||||||
this.value = DefaultValue = value;
|
DefaultValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual T Value
|
public virtual T Value
|
||||||
@@ -34,7 +35,13 @@ public class SettingsValueOption<T> : ISettingsValueOptionValueAccessor where T
|
|||||||
object ISettingsValueOptionValueAccessor.ValueRaw
|
object ISettingsValueOptionValueAccessor.ValueRaw
|
||||||
{
|
{
|
||||||
get => value;
|
get => value;
|
||||||
set => this.value = (T?)(T)value;
|
set
|
||||||
|
{
|
||||||
|
if (value is not null)
|
||||||
|
this.value = Convert.ChangeType(value, typeof(T)) as T?;
|
||||||
|
else
|
||||||
|
this.value = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Reset()
|
public virtual void Reset()
|
||||||
|
|||||||
Reference in New Issue
Block a user