mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-26 13:12:50 +08:00

Also moves tests to `./test` which makes it possible for all test projects to share the same .editorconfig files and similar.
19 lines
519 B
C#
19 lines
519 B
C#
using System.ComponentModel;
|
|
using System.Globalization;
|
|
|
|
namespace Spectre.Console.Tests.Data
|
|
{
|
|
public sealed class StringToIntegerConverter : TypeConverter
|
|
{
|
|
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
|
{
|
|
if (value is string stringValue)
|
|
{
|
|
return int.Parse(stringValue, CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
return base.ConvertFrom(context, culture, value);
|
|
}
|
|
}
|
|
}
|