Update Constants.cs

This commit is contained in:
Garry Newman 2020-02-13 11:26:55 +00:00
parent 7baef8966e
commit 4cd8675356

View File

@ -10,21 +10,33 @@ namespace Generator
{
private void Constants()
{
/*
StartBlock( "internal static class CallbackIdentifiers" );
foreach ( var o in def.CallbackIds )
{
WriteLine( $"public const int {o.Key} = {o.Value};" );
}
EndBlock();
StartBlock( "internal static class Defines" );
foreach ( var o in def.Defines )
foreach ( var o in def.Consts )
{
WriteLine( $"internal const string {o.Key} = \"{o.Value}\";" );
var type = o.Type.Substring( "const ".Length );
type = Cleanup.ConvertType( type );
var val = o.Val;
// Don't need to ull in c#
if ( val.EndsWith( "ull" ) )
val = val.Replace( "ull", "" );
val = val.Replace( "uint32", "uint" );
val = val.Replace( "16U", "16" );
val = val.Replace( "8U", "8" );
// we're not an actual typedef so can't cast like this
val = val.Replace( "( SteamItemInstanceID_t ) ~ 0", "~default(ulong)" );
// This is defined as 0xffffffff - which is too big for an int
// It seems like the loop around is required, so we just hard code it
if ( o.Name == "HSERVERQUERY_INVALID" && val == "0xffffffff" )
val = "-1";
WriteLine( $"internal static readonly {type} {o.Name} = {val};" );
}
EndBlock();
*/
}
}
}