using System;
using System.Globalization;
using System.Windows.Data;
using Crysome.Common.Model;

namespace Crysome.Server.Converters;

public class FileSizeConverter : IMultiValueConverter
{
	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		long num = (long)values[0];
		if ((int)(FileType)values[1] == 0)
		{
			return "-";
		}
		string text = "bytes";
		long num2 = num;
		if (num >= 1000)
		{
			text = "KB";
			num2 = num / 1024;
		}
		if (num >= 1000000)
		{
			text = "MB";
			num2 = num / 1048576;
		}
		if (num >= 1000000000)
		{
			text = "GB";
			num2 = num / 1073741824;
		}
		return num2 + " " + text;
	}

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