private long ReadOctalValue(string octal)
{
long val = 0;
for (int i = octal.Length - 1, j = 0; i >= 0; i--, j++)
{
int c;
try
{
c = int.Parse(new string(octal[i], 1), CultureInfo.InvariantCulture);
if (c > 7)
{
_diagnostics.ReportInvalidOctal(CurrentSpan, octal);
return 0;
}
}
catch (FormatException)
{
_diagnostics.ReportInvalidOctal(CurrentSpan, octal);
return 0;
}
checked
{
val += (long)(c * Math.Pow(8, j));
}
}
return val;
}