You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
635 B
C#
24 lines
635 B
C#
|
1 month ago
|
using AI.Utils;
|
||
|
|
using Avalonia.Data.Converters;
|
||
|
|
using System;
|
||
|
|
using System.Globalization;
|
||
|
|
|
||
|
|
namespace AI.Converters
|
||
|
|
{
|
||
|
|
public class FileSizeConverter : IValueConverter
|
||
|
|
{
|
||
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||
|
|
{
|
||
|
|
if (value is long fileSize)
|
||
|
|
{
|
||
|
|
return FileUnit.FormatFileSize(fileSize);
|
||
|
|
}
|
||
|
|
return "0 B";
|
||
|
|
}
|
||
|
|
|
||
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|