private object SmallestDecimal(object constant)
{
if (null == constant)
{
return 0d;
}
else
{
string sval = (constant as string);
if (null != sval)
{
decimal r12;
if (decimal.TryParse(sval, NumberStyles.Number, NumberFormatInfo.InvariantInfo, out r12))
{
return r12;
}
double r8;
if (double.TryParse(sval, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.InvariantInfo, out r8))
{
return r8;
}
}
else
{
IConvertible convertible = (constant as IConvertible);
if (null != convertible)
{
try
{
return convertible.ToDecimal(NumberFormatInfo.InvariantInfo);
}
catch (System.ArgumentException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
catch (System.FormatException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
catch (System.InvalidCastException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
catch (System.OverflowException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
try
{
return convertible.ToDouble(NumberFormatInfo.InvariantInfo);
}
catch (System.ArgumentException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
catch (System.FormatException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
catch (System.InvalidCastException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
catch (System.OverflowException e)
{
ExceptionBuilder.TraceExceptionWithoutRethrow(e);
}
}
}
}
return constant;
}