static private TryParseByteVb6 ( string Expression, byte &Value ) : bool | ||
Expression | string | |
Value | byte | |
return | bool |
internal static bool TryParseByteVb6(string Expression, out byte Value) {
Expression = TrimInside(Expression);
CultureInfo Culture = CultureInfo.InvariantCulture;
for (int n = Expression.Length; n > 0; n--) {
double a;
if (double.TryParse(Expression.Substring(0, n), NumberStyles.Float, Culture, out a)) {
if (a >= 0.0 & a <= 255.0) {
Value = (byte)Math.Round(a);
return true;
} else break;
}
}
Value = 0;
return false;
}