Crunchy-Downloader/CRD/Utils/UI/UiEnumToBoolConverter.cs
Elwador 67f3d7a84a Add - Added option to **download audio only as MP3**
Add - Added **File Name Whitespace Substitute** option in settings [#284](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/284)
Add - Added **download mode toggle (video/audio/subs)** for seasons with the ability to switch between options [#281](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/281)
Add - Added **download all** for only (video/audio/subs) for a season [#281](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/281)
Chg - Changed to **display a message** when the calendar fails to load due to Cloudflare issues [#283](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/283)
Chg - Adjusted **Calendar upcoming filter** for improved accuracy
Fix - Fixed **duplicate/wrong Crunchyroll versions** appearing in downloads [#285](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/285)
Fix - Fixed issue where **episodes with non-Japanese audio URLs** couldn't be added
Fix - Fixed **calendar crash** on Cloudflare failure [#283](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/283)
Fix - Fixed **audio-only downloads** [#279](https://github.com/Crunchy-DL/Crunchy-Downloader/issues/279)
Fix - Fixed **crash when no featured music** is present
Fix - Fixed **"All" button not working** for music in the Add Downloads tab
Fix - Fixed that an **empty File Name Whitespace Substitute** removed all whitespaces
2025-06-28 09:13:28 +02:00

26 lines
No EOL
800 B
C#

using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace CRD.Utils.UI;
public class UiEnumToBoolConverter : IValueConverter{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture){
if (value == null || parameter == null)
return false;
string enumString = parameter.ToString();
if (enumString == null)
return false;
return value.ToString() == enumString;
}
public object ConvertBack(object value, Type targetType, object? parameter, CultureInfo culture){
if ((bool)value && parameter != null){
return Enum.Parse(targetType, parameter.ToString() ?? string.Empty);
}
return Avalonia.Data.BindingOperations.DoNothing;
}
}