mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Change Supported to Enum
This commit is contained in:
@@ -819,6 +819,37 @@ namespace SabreTools.Library.Tools
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Supported value from input string
|
||||
/// </summary>
|
||||
/// <param name="supported">String to get value from</param>
|
||||
/// <returns>Supported value corresponding to the string</returns>
|
||||
public static Supported AsSupported(this string supported)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (supported?.ToLowerInvariant())
|
||||
{
|
||||
case "no":
|
||||
return Supported.No;
|
||||
case "partial":
|
||||
return Supported.Partial;
|
||||
case "yes":
|
||||
return Supported.Yes;
|
||||
default:
|
||||
return Supported.NULL;
|
||||
}
|
||||
#else
|
||||
return supported?.ToLowerInvariant() switch
|
||||
{
|
||||
"no" => Supported.No,
|
||||
"partial" => Supported.Partial,
|
||||
"yes" => Supported.Yes,
|
||||
_ => Supported.NULL,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get bool? value from input string
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user