a lot of work
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Utils;
|
||||
|
||||
public class DictionaryValueConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (parameter is IDictionary dict && value != null && dict.Contains(value))
|
||||
return dict[value];
|
||||
return value?.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
9
ModpackUpdater.Apps.Manager/Utils/Extensions.cs
Normal file
9
ModpackUpdater.Apps.Manager/Utils/Extensions.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace ModpackUpdater.Apps.Manager.Utils;
|
||||
|
||||
internal static class Extensions
|
||||
{
|
||||
public static string? Nullify(this string? @this)
|
||||
{
|
||||
return string.IsNullOrEmpty(@this) ? null : @this;
|
||||
}
|
||||
}
|
||||
12
ModpackUpdater.Apps.Manager/Utils/MyFilePickerFileTypes.cs
Normal file
12
ModpackUpdater.Apps.Manager/Utils/MyFilePickerFileTypes.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Platform.Storage;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Utils;
|
||||
|
||||
public class MyFilePickerFileTypes
|
||||
{
|
||||
public static FilePickerFileType Excel { get; } = new("Excel")
|
||||
{
|
||||
Patterns = ["*.xlsx"],
|
||||
MimeTypes = ["application/vnd.ms-excel"]
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user