using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media; namespace Crysome.Server.Converters; [ValueConversion(typeof(bool), typeof(Color))] public class InventoryPresentToColorConverter : IValueConverter { private static readonly Color Found = Color.FromRgb(111, 207, 151); private static readonly Color Missing = Color.FromRgb(85, 85, 85); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (((uint)num & (flag ? 1u : 0u)) != 0) ? Found : Missing; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } }