mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-30 20:27:01 +00:00
Fixed implementation of IsValue. Improved the handling of value
(number) parameters.
This commit is contained in:
parent
7296edafac
commit
e08baaa624
|
@ -217,6 +217,12 @@ namespace Bind
|
|||
{
|
||||
StringBuilder translator = new StringBuilder(s.Length);
|
||||
|
||||
if (isValue)
|
||||
{
|
||||
translator.Append(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Translate the constant's name to match .Net naming conventions
|
||||
bool name_is_all_caps = s.AsEnumerable().All(c => Char.IsLetter(c) ? Char.IsUpper(c) : true);
|
||||
bool name_contains_underscore = s.Contains("_");
|
||||
|
@ -259,14 +265,13 @@ namespace Bind
|
|||
}
|
||||
else
|
||||
translator.Append(s);
|
||||
}
|
||||
|
||||
return translator.ToString();
|
||||
}
|
||||
|
||||
public static string TranslateConstantValue(string value)
|
||||
{
|
||||
if (value.ToLower() == " 0xffffffffffffffff") System.Diagnostics.Debugger.Break();
|
||||
|
||||
// Remove decorations to get a pure number (e.g. 0x80u -> 80).
|
||||
if (value.ToLower().StartsWith("0x"))
|
||||
{
|
||||
|
@ -325,11 +330,22 @@ namespace Bind
|
|||
|
||||
static bool IsValue(string test)
|
||||
{
|
||||
ulong number;
|
||||
|
||||
// Check if the result is a number.
|
||||
return UInt64.TryParse(test.ToLower().Replace("0x", String.Empty),
|
||||
NumberStyles.AllowHexSpecifier, null, out number);
|
||||
long number;
|
||||
bool is_number = false;
|
||||
if (test.ToLower().StartsWith("0x"))
|
||||
{
|
||||
is_number = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_number = Int64.TryParse(
|
||||
test,
|
||||
NumberStyles.Number,
|
||||
System.Globalization.CultureInfo.InvariantCulture,
|
||||
out number);
|
||||
}
|
||||
return is_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue