mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-08 22:38:28 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
32 lines
784 B
C#
32 lines
784 B
C#
namespace Facepunch.InteropGen;
|
|
|
|
//
|
|
// Note: Only supporting passing string to native right now
|
|
//
|
|
[TypeName( "stringtoken" )]
|
|
public class ArgStringToken : Arg
|
|
{
|
|
public override string ManagedType => "Sandbox.StringToken";
|
|
public override string ManagedDelegateType => "Sandbox.StringToken";
|
|
public override string NativeType => "uint32";
|
|
|
|
public override string ToInterop( bool native, string code = null )
|
|
{
|
|
// if ( code == null ) code = Name;
|
|
|
|
// if ( !native )
|
|
// {
|
|
// return $"Sandbox.StringToken.FindOrCreate( {code} )";
|
|
// }
|
|
|
|
return base.ToInterop( native, code );
|
|
}
|
|
|
|
public override string FromInterop( bool native, string code = null )
|
|
{
|
|
code ??= Name;
|
|
|
|
return native ? $"StringTokenFromHashCode( {code} )" : base.ToInterop( native, code );
|
|
}
|
|
}
|