2023-07-19 07:10:25 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
2023-10-01 18:40:41 +02:00
|
|
|
|
namespace TaikoSoundEditor.Commons.Utils
|
2023-07-19 07:10:25 +02:00
|
|
|
|
{
|
|
|
|
|
internal static class Number
|
|
|
|
|
{
|
|
|
|
|
public static int ParseInt(string value)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return int.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch(FormatException ex)
|
|
|
|
|
{
|
2023-07-28 17:15:05 +02:00
|
|
|
|
throw new FormatException($"{ex.Message} : '{value ?? "<null>"}' to int", ex);
|
2023-07-19 07:10:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static float ParseFloat(string value)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return float.Parse(value);
|
|
|
|
|
}
|
|
|
|
|
catch (FormatException ex)
|
|
|
|
|
{
|
|
|
|
|
throw new FormatException($"{ex.Message} : {value} to float", ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|