
namespace HistoryView.Converters;

public class SizeConvert : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not int && parameter is not string)
            return value;

        try
        {
            if (int.TryParse(parameter.ToString(), out int scale))
                return (int)value / scale;
        }
        catch
        {
        }

        return value;

    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
