chore: deprecate standalone SecureStoreManager utility
Move SecureStoreManager project and tests to Deprecated folder and remove from solution. SecureStore functionality is now integrated into ConfigManager.
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace JdeScoping.SecureStoreManager.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Inverts a boolean value.
|
||||
/// </summary>
|
||||
public class InverseBooleanConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a boolean value to its inverted counterpart.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean value to invert.</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>The inverted boolean value, or false if the input is not a boolean.</returns>
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool boolValue)
|
||||
{
|
||||
return !boolValue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value back to a boolean by inverting it.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to invert.</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>The inverted boolean value, or false if the input is not a boolean.</returns>
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool boolValue)
|
||||
{
|
||||
return !boolValue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a boolean to a visibility icon (eye open/closed).
|
||||
/// </summary>
|
||||
public class BooleanToVisibilityIconConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a boolean to a visibility icon string.
|
||||
/// </summary>
|
||||
/// <param name="value">The boolean value indicating visibility.</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>"Hide" if true, "Show" if false or input is not boolean.</returns>
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool isVisible)
|
||||
{
|
||||
// Use simple text icons for cross-platform compatibility
|
||||
return isVisible ? "Hide" : "Show";
|
||||
}
|
||||
return "Show";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value back (not implemented for visibility icons).
|
||||
/// </summary>
|
||||
/// <param name="value">The value to convert back (ignored).</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>Not implemented.</returns>
|
||||
/// <exception cref="NotImplementedException">Always thrown.</exception>
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts null to bool (null = false, not null = true).
|
||||
/// </summary>
|
||||
public class NullToBoolConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a value to a boolean based on null status.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to check for null.</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>True if value is not null, false otherwise.</returns>
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value back (not implemented for null checks).
|
||||
/// </summary>
|
||||
/// <param name="value">The value to convert back (ignored).</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>Not implemented.</returns>
|
||||
/// <exception cref="NotImplementedException">Always thrown.</exception>
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a string to bool (empty = false, not empty = true).
|
||||
/// </summary>
|
||||
public class StringToBoolConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a string to a boolean based on whether it's empty or null.
|
||||
/// </summary>
|
||||
/// <param name="value">The string value to check.</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>True if string is not null or whitespace, false otherwise.</returns>
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string str)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(str);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value back (not implemented for string checks).
|
||||
/// </summary>
|
||||
/// <param name="value">The value to convert back (ignored).</param>
|
||||
/// <param name="targetType">The target type (ignored).</param>
|
||||
/// <param name="parameter">An optional parameter (ignored).</param>
|
||||
/// <param name="culture">The culture information (ignored).</param>
|
||||
/// <returns>Not implemented.</returns>
|
||||
/// <exception cref="NotImplementedException">Always thrown.</exception>
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user