Files @ d6859ea7177f
Branch filter:

Location: ATITD-Tools/Desert-Paint-Codex/Converters/NotEnumBooleanConverter.cs

Jason Maltzen
Add some sanity checks on min/max concentration and min/max reagents in recipe generation. Also, clear out the search queue when generation has finished so the queue isn't loaded next time. This fixes the start/resume button state when entering the recipe generator after a prior run had finished.
using System;

namespace DesertPaintCodex.Converters
{
    public class NotEnumBooleanConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is not Enum en) return false;
            
            string? parameterString = parameter.ToString();
            if (parameterString == null) return false;
            
            object parameterValue = Enum.Parse(value.GetType(), parameterString);
            return !parameterValue.Equals(value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new InvalidOperationException("NotEnumBooleanoConverter can only be used OneWay.");
        }
    }
}