You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.TrashLib/Config/Parsing/BackwardCompatibility/ResetUnmatchedScoresYamlTyp...

23 lines
681 B

using System.ComponentModel;
using System.Globalization;
namespace Recyclarr.TrashLib.Config.Parsing.BackwardCompatibility;
public class ResetUnmatchedScoresYamlTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
{
return sourceType == typeof(bool) || sourceType == typeof(string);
}
public override object ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
{
var enabledFlag = Convert.ToBoolean(value);
return new ResetUnmatchedScoresConfigYaml
{
FromBool = true,
Enabled = enabledFlag
};
}
}