mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Cleanup, native classes disposable
This commit is contained in:
parent
4b4f405a79
commit
c37ea38107
@ -92,10 +92,100 @@ public void Dispose()
|
|||||||
{
|
{
|
||||||
if ( client != null )
|
if ( client != null )
|
||||||
{
|
{
|
||||||
|
client.Dispose();
|
||||||
client = null;
|
client = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
api.SteamAPI_Shutdown();
|
if ( user != null )
|
||||||
|
{
|
||||||
|
user.Dispose();
|
||||||
|
user = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( utils != null )
|
||||||
|
{
|
||||||
|
utils.Dispose();
|
||||||
|
utils = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( networking != null )
|
||||||
|
{
|
||||||
|
networking.Dispose();
|
||||||
|
networking = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( gameServerStats != null )
|
||||||
|
{
|
||||||
|
gameServerStats.Dispose();
|
||||||
|
gameServerStats = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( http != null )
|
||||||
|
{
|
||||||
|
http.Dispose();
|
||||||
|
http = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( inventory != null )
|
||||||
|
{
|
||||||
|
inventory.Dispose();
|
||||||
|
inventory = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ugc != null )
|
||||||
|
{
|
||||||
|
ugc.Dispose();
|
||||||
|
ugc = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( apps != null )
|
||||||
|
{
|
||||||
|
apps.Dispose();
|
||||||
|
apps = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( gameServer != null )
|
||||||
|
{
|
||||||
|
gameServer.Dispose();
|
||||||
|
gameServer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( friends != null )
|
||||||
|
{
|
||||||
|
friends.Dispose();
|
||||||
|
friends = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( servers != null )
|
||||||
|
{
|
||||||
|
servers.Dispose();
|
||||||
|
servers = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( userstats != null )
|
||||||
|
{
|
||||||
|
userstats.Dispose();
|
||||||
|
userstats = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( screenshots != null )
|
||||||
|
{
|
||||||
|
screenshots.Dispose();
|
||||||
|
screenshots = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( remoteStorage != null )
|
||||||
|
{
|
||||||
|
remoteStorage.Dispose();
|
||||||
|
remoteStorage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( api != null )
|
||||||
|
{
|
||||||
|
api.SteamAPI_Shutdown();
|
||||||
|
api.Dispose();
|
||||||
|
api = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace SteamNative
|
|||||||
{
|
{
|
||||||
internal static partial class Platform
|
internal static partial class Platform
|
||||||
{
|
{
|
||||||
public interface Interface
|
public interface Interface : IDisposable
|
||||||
{
|
{
|
||||||
// Implementation should return true if _ptr is non null
|
// Implementation should return true if _ptr is non null
|
||||||
bool IsValid { get; }
|
bool IsValid { get; }
|
||||||
|
@ -10,10 +10,21 @@ public class Linux32 : Interface
|
|||||||
internal IntPtr _ptr;
|
internal IntPtr _ptr;
|
||||||
public bool IsValid { get{ return _ptr != null; } }
|
public bool IsValid { get{ return _ptr != null; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor sets pointer to native class
|
||||||
|
//
|
||||||
public Linux32( IntPtr pointer )
|
public Linux32( IntPtr pointer )
|
||||||
{
|
{
|
||||||
_ptr = pointer;
|
_ptr = pointer;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
_ptr = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
||||||
{
|
{
|
||||||
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
||||||
|
@ -10,10 +10,21 @@ public class Linux64 : Interface
|
|||||||
internal IntPtr _ptr;
|
internal IntPtr _ptr;
|
||||||
public bool IsValid { get{ return _ptr != null; } }
|
public bool IsValid { get{ return _ptr != null; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor sets pointer to native class
|
||||||
|
//
|
||||||
public Linux64( IntPtr pointer )
|
public Linux64( IntPtr pointer )
|
||||||
{
|
{
|
||||||
_ptr = pointer;
|
_ptr = pointer;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
_ptr = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
||||||
{
|
{
|
||||||
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
||||||
|
@ -10,10 +10,21 @@ public class Mac : Interface
|
|||||||
internal IntPtr _ptr;
|
internal IntPtr _ptr;
|
||||||
public bool IsValid { get{ return _ptr != null; } }
|
public bool IsValid { get{ return _ptr != null; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor sets pointer to native class
|
||||||
|
//
|
||||||
public Mac( IntPtr pointer )
|
public Mac( IntPtr pointer )
|
||||||
{
|
{
|
||||||
_ptr = pointer;
|
_ptr = pointer;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
_ptr = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
||||||
{
|
{
|
||||||
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
||||||
|
@ -10,10 +10,21 @@ public class Win32 : Interface
|
|||||||
internal IntPtr _ptr;
|
internal IntPtr _ptr;
|
||||||
public bool IsValid { get{ return _ptr != null; } }
|
public bool IsValid { get{ return _ptr != null; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor sets pointer to native class
|
||||||
|
//
|
||||||
public Win32( IntPtr pointer )
|
public Win32( IntPtr pointer )
|
||||||
{
|
{
|
||||||
_ptr = pointer;
|
_ptr = pointer;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
_ptr = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
||||||
{
|
{
|
||||||
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
||||||
|
@ -10,10 +10,21 @@ public class Win64 : Interface
|
|||||||
internal IntPtr _ptr;
|
internal IntPtr _ptr;
|
||||||
public bool IsValid { get{ return _ptr != null; } }
|
public bool IsValid { get{ return _ptr != null; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor sets pointer to native class
|
||||||
|
//
|
||||||
public Win64( IntPtr pointer )
|
public Win64( IntPtr pointer )
|
||||||
{
|
{
|
||||||
_ptr = pointer;
|
_ptr = pointer;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
_ptr = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
public virtual HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe()
|
||||||
{
|
{
|
||||||
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
if ( _ptr == null ) throw new System.Exception( "ISteamClient _ptr is null!" );
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamApi
|
public unsafe class SteamApi : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamApi( IntPtr pointer )
|
public SteamApi( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamApi( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// HSteamPipe
|
// HSteamPipe
|
||||||
public HSteamPipe SteamAPI_GetHSteamPipe()
|
public HSteamPipe SteamAPI_GetHSteamPipe()
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamAppList
|
public unsafe class SteamAppList : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamAppList( IntPtr pointer )
|
public SteamAppList( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamAppList( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// int
|
// int
|
||||||
public int GetAppBuildId( AppId_t nAppID /*AppId_t*/ )
|
public int GetAppBuildId( AppId_t nAppID /*AppId_t*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamApps
|
public unsafe class SteamApps : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamApps( IntPtr pointer )
|
public SteamApps( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamApps( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
// with: Detect_StringFetch False
|
// with: Detect_StringFetch False
|
||||||
public bool BGetDLCDataByIndex( int iDLC /*int*/, ref AppId_t pAppID /*AppId_t **/, out bool pbAvailable /*bool **/, out string pchName /*char **/ )
|
public bool BGetDLCDataByIndex( int iDLC /*int*/, ref AppId_t pAppID /*AppId_t **/, out bool pbAvailable /*bool **/, out string pchName /*char **/ )
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamClient
|
public unsafe class SteamClient : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamClient( IntPtr pointer )
|
public SteamClient( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamClient( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool BReleaseSteamPipe( HSteamPipe hSteamPipe /*HSteamPipe*/ )
|
public bool BReleaseSteamPipe( HSteamPipe hSteamPipe /*HSteamPipe*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamController
|
public unsafe class SteamController : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamController( IntPtr pointer )
|
public SteamController( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamController( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void
|
// void
|
||||||
public void ActivateActionSet( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetHandle /*ControllerActionSetHandle_t*/ )
|
public void ActivateActionSet( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetHandle /*ControllerActionSetHandle_t*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamFriends
|
public unsafe class SteamFriends : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamFriends( IntPtr pointer )
|
public SteamFriends( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamFriends( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void
|
// void
|
||||||
public void ActivateGameOverlay( string pchDialog /*const char **/ )
|
public void ActivateGameOverlay( string pchDialog /*const char **/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamGameServer
|
public unsafe class SteamGameServer : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamGameServer( IntPtr pointer )
|
public SteamGameServer( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamGameServer( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SteamAPICall_t
|
// SteamAPICall_t
|
||||||
public SteamAPICall_t AssociateWithClan( CSteamID steamIDClan /*class CSteamID*/ )
|
public SteamAPICall_t AssociateWithClan( CSteamID steamIDClan /*class CSteamID*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamGameServerStats
|
public unsafe class SteamGameServerStats : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamGameServerStats( IntPtr pointer )
|
public SteamGameServerStats( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamGameServerStats( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool ClearUserAchievement( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/ )
|
public bool ClearUserAchievement( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamHTMLSurface
|
public unsafe class SteamHTMLSurface : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamHTMLSurface( IntPtr pointer )
|
public SteamHTMLSurface( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamHTMLSurface( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void
|
// void
|
||||||
public void AddHeader( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, string pchKey /*const char **/, string pchValue /*const char **/ )
|
public void AddHeader( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, string pchKey /*const char **/, string pchValue /*const char **/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamHTTP
|
public unsafe class SteamHTTP : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamHTTP( IntPtr pointer )
|
public SteamHTTP( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamHTTP( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// HTTPCookieContainerHandle
|
// HTTPCookieContainerHandle
|
||||||
public HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify /*bool*/ )
|
public HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify /*bool*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamInventory
|
public unsafe class SteamInventory : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamInventory( IntPtr pointer )
|
public SteamInventory( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamInventory( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool AddPromoItem( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t itemDef /*SteamItemDef_t*/ )
|
public bool AddPromoItem( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t itemDef /*SteamItemDef_t*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamMatchmaking
|
public unsafe class SteamMatchmaking : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamMatchmaking( IntPtr pointer )
|
public SteamMatchmaking( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamMatchmaking( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// int
|
// int
|
||||||
public int AddFavoriteGame( AppId_t nAppID /*AppId_t*/, uint nIP /*uint32*/, ushort nConnPort /*uint16*/, ushort nQueryPort /*uint16*/, uint unFlags /*uint32*/, uint rTime32LastPlayedOnServer /*uint32*/ )
|
public int AddFavoriteGame( AppId_t nAppID /*AppId_t*/, uint nIP /*uint32*/, ushort nConnPort /*uint16*/, ushort nQueryPort /*uint16*/, uint unFlags /*uint32*/, uint rTime32LastPlayedOnServer /*uint32*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamMatchmakingServers
|
public unsafe class SteamMatchmakingServers : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamMatchmakingServers( IntPtr pointer )
|
public SteamMatchmakingServers( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamMatchmakingServers( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void
|
// void
|
||||||
public void CancelQuery( HServerListRequest hRequest /*HServerListRequest*/ )
|
public void CancelQuery( HServerListRequest hRequest /*HServerListRequest*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamMusic
|
public unsafe class SteamMusic : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamMusic( IntPtr pointer )
|
public SteamMusic( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamMusic( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool BIsEnabled()
|
public bool BIsEnabled()
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamMusicRemote
|
public unsafe class SteamMusicRemote : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamMusicRemote( IntPtr pointer )
|
public SteamMusicRemote( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamMusicRemote( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool BActivationSuccess( bool bValue /*bool*/ )
|
public bool BActivationSuccess( bool bValue /*bool*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamNetworking
|
public unsafe class SteamNetworking : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamNetworking( IntPtr pointer )
|
public SteamNetworking( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamNetworking( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool AcceptP2PSessionWithUser( CSteamID steamIDRemote /*class CSteamID*/ )
|
public bool AcceptP2PSessionWithUser( CSteamID steamIDRemote /*class CSteamID*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamRemoteStorage
|
public unsafe class SteamRemoteStorage : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamRemoteStorage( IntPtr pointer )
|
public SteamRemoteStorage( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamRemoteStorage( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SteamAPICall_t
|
// SteamAPICall_t
|
||||||
public SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle /*PublishedFileUpdateHandle_t*/ )
|
public SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle /*PublishedFileUpdateHandle_t*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamScreenshots
|
public unsafe class SteamScreenshots : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamScreenshots( IntPtr pointer )
|
public SteamScreenshots( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamScreenshots( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ScreenshotHandle
|
// ScreenshotHandle
|
||||||
public ScreenshotHandle AddScreenshotToLibrary( string pchFilename /*const char **/, string pchThumbnailFilename /*const char **/, int nWidth /*int*/, int nHeight /*int*/ )
|
public ScreenshotHandle AddScreenshotToLibrary( string pchFilename /*const char **/, string pchThumbnailFilename /*const char **/, int nWidth /*int*/, int nHeight /*int*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamUGC
|
public unsafe class SteamUGC : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamUGC( IntPtr pointer )
|
public SteamUGC( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamUGC( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool AddExcludedTag( UGCQueryHandle_t handle /*UGCQueryHandle_t*/, string pTagName /*const char **/ )
|
public bool AddExcludedTag( UGCQueryHandle_t handle /*UGCQueryHandle_t*/, string pTagName /*const char **/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamUnifiedMessages
|
public unsafe class SteamUnifiedMessages : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamUnifiedMessages( IntPtr pointer )
|
public SteamUnifiedMessages( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamUnifiedMessages( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle /*ClientUnifiedMessageHandle*/, IntPtr pResponseBuffer /*void **/, uint unResponseBufferSize /*uint32*/, bool bAutoRelease /*bool*/ )
|
public bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle /*ClientUnifiedMessageHandle*/, IntPtr pResponseBuffer /*void **/, uint unResponseBufferSize /*uint32*/, bool bAutoRelease /*bool*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamUser
|
public unsafe class SteamUser : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamUser( IntPtr pointer )
|
public SteamUser( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamUser( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void
|
// void
|
||||||
public void AdvertiseGame( CSteamID steamIDGameServer /*class CSteamID*/, uint unIPServer /*uint32*/, ushort usPortServer /*uint16*/ )
|
public void AdvertiseGame( CSteamID steamIDGameServer /*class CSteamID*/, uint unIPServer /*uint32*/, ushort usPortServer /*uint16*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamUserStats
|
public unsafe class SteamUserStats : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamUserStats( IntPtr pointer )
|
public SteamUserStats( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamUserStats( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SteamAPICall_t
|
// SteamAPICall_t
|
||||||
public SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard /*SteamLeaderboard_t*/, UGCHandle_t hUGC /*UGCHandle_t*/ )
|
public SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard /*SteamLeaderboard_t*/, UGCHandle_t hUGC /*UGCHandle_t*/ )
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamUtils
|
public unsafe class SteamUtils : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamUtils( IntPtr pointer )
|
public SteamUtils( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamUtils( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
public bool BOverlayNeedsPresent()
|
public bool BOverlayNeedsPresent()
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,16 @@
|
|||||||
|
|
||||||
namespace SteamNative
|
namespace SteamNative
|
||||||
{
|
{
|
||||||
public unsafe class SteamVideo
|
public unsafe class SteamVideo : IDisposable
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Holds a platform specific implentation
|
||||||
|
//
|
||||||
internal Platform.Interface _pi;
|
internal Platform.Interface _pi;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor decides which implementation to use based on current platform
|
||||||
|
//
|
||||||
public SteamVideo( IntPtr pointer )
|
public SteamVideo( IntPtr pointer )
|
||||||
{
|
{
|
||||||
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );
|
||||||
@ -16,8 +22,23 @@ public SteamVideo( IntPtr pointer )
|
|||||||
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class is invalid if we don't have a valid implementation
|
||||||
|
//
|
||||||
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }
|
||||||
|
|
||||||
|
//
|
||||||
|
// When shutting down clear all the internals to avoid accidental use
|
||||||
|
//
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
if ( _pi != null )
|
||||||
|
{
|
||||||
|
_pi.Dispose();
|
||||||
|
_pi = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void
|
// void
|
||||||
public void GetVideoURL( AppId_t unVideoAppID /*AppId_t*/ )
|
public void GetVideoURL( AppId_t unVideoAppID /*AppId_t*/ )
|
||||||
{
|
{
|
||||||
|
@ -8,9 +8,6 @@ namespace Generator
|
|||||||
{
|
{
|
||||||
public partial class CodeWriter
|
public partial class CodeWriter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool LargePack;
|
bool LargePack;
|
||||||
|
|
||||||
private void PlatformClass( string type, string libraryName, bool LargePack )
|
private void PlatformClass( string type, string libraryName, bool LargePack )
|
||||||
@ -18,43 +15,54 @@ private void PlatformClass( string type, string libraryName, bool LargePack )
|
|||||||
this.LargePack = LargePack;
|
this.LargePack = LargePack;
|
||||||
|
|
||||||
StartBlock( $"internal static partial class Platform" );
|
StartBlock( $"internal static partial class Platform" );
|
||||||
StartBlock( $"public class {type} : Interface" );
|
|
||||||
|
|
||||||
WriteLine( "internal IntPtr _ptr;" );
|
|
||||||
WriteLine( "public bool IsValid { get{ return _ptr != null; } }" );
|
|
||||||
|
|
||||||
WriteLine();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor
|
|
||||||
//
|
|
||||||
StartBlock( $"public {type}( IntPtr pointer )" );
|
|
||||||
WriteLine( "_ptr = pointer;" );
|
|
||||||
EndBlock();
|
|
||||||
|
|
||||||
foreach ( var c in def.methods.GroupBy( x => x.ClassName ) )
|
|
||||||
{
|
{
|
||||||
PlatformClass( c.Key, c.ToArray() );
|
StartBlock( $"public class {type} : Interface" );
|
||||||
}
|
{
|
||||||
|
WriteLine( "internal IntPtr _ptr;" );
|
||||||
|
WriteLine( "public bool IsValid { get{ return _ptr != null; } }" );
|
||||||
|
WriteLine();
|
||||||
|
|
||||||
StartBlock( $"internal static unsafe class Native" );
|
WriteLine( "//" );
|
||||||
foreach ( var c in def.methods.GroupBy( x => x.ClassName ) )
|
WriteLine( "// Constructor sets pointer to native class" );
|
||||||
{
|
WriteLine( "//" );
|
||||||
InteropClass( libraryName, c.Key, c.ToArray() );
|
StartBlock( $"public {type}( IntPtr pointer )" );
|
||||||
}
|
{
|
||||||
EndBlock();
|
WriteLine( "_ptr = pointer;" );
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
|
||||||
EndBlock();
|
WriteLine( "//" );
|
||||||
|
WriteLine( "// When shutting down clear all the internals to avoid accidental use" );
|
||||||
|
WriteLine( "//" );
|
||||||
|
StartBlock( $"public virtual void Dispose()" );
|
||||||
|
{
|
||||||
|
WriteLine( "_ptr = IntPtr.Zero;" );
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
WriteLine();
|
||||||
|
|
||||||
|
foreach ( var c in def.methods.GroupBy( x => x.ClassName ) )
|
||||||
|
{
|
||||||
|
PlatformClass( c.Key, c.ToArray() );
|
||||||
|
}
|
||||||
|
|
||||||
|
StartBlock( $"internal static unsafe class Native" );
|
||||||
|
{
|
||||||
|
foreach ( var c in def.methods.GroupBy( x => x.ClassName ) )
|
||||||
|
{
|
||||||
|
InteropClass( libraryName, c.Key, c.ToArray() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
}
|
||||||
EndBlock();
|
EndBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlatformClass( string className, SteamApiDefinition.MethodDef[] methodDef )
|
private void PlatformClass( string className, SteamApiDefinition.MethodDef[] methodDef )
|
||||||
{
|
{
|
||||||
if ( className == "ISteamMatchmakingPingResponse" ) return;
|
if ( ShouldIgnoreClass( className ) ) return;
|
||||||
if ( className == "ISteamMatchmakingServerListResponse" ) return;
|
|
||||||
if ( className == "ISteamMatchmakingPlayersResponse" ) return;
|
|
||||||
if ( className == "ISteamMatchmakingRulesResponse" ) return;
|
|
||||||
if ( className == "ISteamMatchmakingPingResponse" ) return;
|
|
||||||
|
|
||||||
LastMethodName = "";
|
LastMethodName = "";
|
||||||
foreach ( var m in methodDef )
|
foreach ( var m in methodDef )
|
||||||
@ -169,11 +177,7 @@ private void InteropClassMethod( string library, string classname, SteamApiDefin
|
|||||||
|
|
||||||
private void InteropClass( string libraryName, string className, SteamApiDefinition.MethodDef[] methodDef )
|
private void InteropClass( string libraryName, string className, SteamApiDefinition.MethodDef[] methodDef )
|
||||||
{
|
{
|
||||||
if ( className == "ISteamMatchmakingPingResponse" ) return;
|
if ( ShouldIgnoreClass( className ) ) return;
|
||||||
if ( className == "ISteamMatchmakingServerListResponse" ) return;
|
|
||||||
if ( className == "ISteamMatchmakingPlayersResponse" ) return;
|
|
||||||
if ( className == "ISteamMatchmakingRulesResponse" ) return;
|
|
||||||
if ( className == "ISteamMatchmakingPingResponse" ) return;
|
|
||||||
|
|
||||||
StartBlock( $"internal static unsafe class {className}" );
|
StartBlock( $"internal static unsafe class {className}" );
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public void ToFolder( string folder )
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Classes( $"{folder}SteamNative." );
|
Class( $"{folder}SteamNative." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,72 +8,7 @@ namespace Generator
|
|||||||
{
|
{
|
||||||
public partial class CodeWriter
|
public partial class CodeWriter
|
||||||
{
|
{
|
||||||
void Classes( string targetName )
|
|
||||||
{
|
|
||||||
foreach ( var g in def.methods.GroupBy( x => x.ClassName ) )
|
|
||||||
{
|
|
||||||
if ( g.Key == "ISteamMatchmakingPingResponse" ) continue;
|
|
||||||
if ( g.Key == "ISteamMatchmakingServerListResponse" ) continue;
|
|
||||||
if ( g.Key == "ISteamMatchmakingPlayersResponse" ) continue;
|
|
||||||
if ( g.Key == "ISteamMatchmakingRulesResponse" ) continue;
|
|
||||||
if ( g.Key == "ISteamMatchmakingPingResponse" ) continue;
|
|
||||||
if ( g.Key == "ISteamMatchmakingPingResponse" ) continue;
|
|
||||||
|
|
||||||
if ( g.Key == "SteamApi" )
|
|
||||||
{
|
|
||||||
sb = new StringBuilder();
|
|
||||||
Header();
|
|
||||||
Class( "SteamApi", g.OrderBy( x => x.Name ).ToArray() );
|
|
||||||
Footer();
|
|
||||||
System.IO.File.WriteAllText( $"{targetName}SteamApi.cs", sb.ToString() );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sb = new StringBuilder();
|
|
||||||
Header();
|
|
||||||
Class( g.Key, g.OrderBy( x => x.Name ).ToArray() );
|
|
||||||
Footer();
|
|
||||||
System.IO.File.WriteAllText( $"{targetName}{g.Key.Substring( 1 )}.cs", sb.ToString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Class( string classname, SteamApiDefinition.MethodDef[] methodDef )
|
|
||||||
{
|
|
||||||
var GenerateClassName = classname;
|
|
||||||
if ( classname[0] == 'I' ) GenerateClassName = classname.Substring( 1 );
|
|
||||||
|
|
||||||
StartBlock( $"public unsafe class {GenerateClassName}" );
|
|
||||||
|
|
||||||
WriteLine( "internal Platform.Interface _pi;" );
|
|
||||||
|
|
||||||
WriteLine();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor
|
|
||||||
//
|
|
||||||
StartBlock( $"public {GenerateClassName}( IntPtr pointer )" );
|
|
||||||
|
|
||||||
WriteLine( "if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );" );
|
|
||||||
WriteLine( "else if ( Platform.IsWindows32 ) _pi = new Platform.Win32( pointer );" );
|
|
||||||
WriteLine( "else if ( Platform.IsLinux32 ) _pi = new Platform.Linux32( pointer );" );
|
|
||||||
WriteLine( "else if ( Platform.IsLinux64 ) _pi = new Platform.Linux64( pointer );" );
|
|
||||||
WriteLine( "else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );" );
|
|
||||||
|
|
||||||
EndBlock();
|
|
||||||
WriteLine();
|
|
||||||
WriteLine( "public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }" );
|
|
||||||
WriteLine();
|
|
||||||
|
|
||||||
LastMethodName = "";
|
|
||||||
|
|
||||||
foreach ( var m in methodDef )
|
|
||||||
ClassMethod( classname, m );
|
|
||||||
|
|
||||||
EndBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
string LastMethodName;
|
string LastMethodName;
|
||||||
|
|
||||||
List<string> BeforeLines;
|
List<string> BeforeLines;
|
||||||
List<string> AfterLines;
|
List<string> AfterLines;
|
||||||
string ReturnType;
|
string ReturnType;
|
||||||
@ -81,6 +16,81 @@ private void Class( string classname, SteamApiDefinition.MethodDef[] methodDef )
|
|||||||
SteamApiDefinition.MethodDef MethodDef;
|
SteamApiDefinition.MethodDef MethodDef;
|
||||||
string ClassName;
|
string ClassName;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Output a class into a file
|
||||||
|
//
|
||||||
|
void Class( string FileName )
|
||||||
|
{
|
||||||
|
foreach ( var g in def.methods.GroupBy( x => x.ClassName ) )
|
||||||
|
{
|
||||||
|
if ( ShouldIgnoreClass( g.Key ) ) continue;
|
||||||
|
|
||||||
|
sb = new StringBuilder();
|
||||||
|
Header();
|
||||||
|
Class( g.Key, g.OrderBy( x => x.Name ).ToArray() );
|
||||||
|
Footer();
|
||||||
|
System.IO.File.WriteAllText( $"{FileName}{InterfaceNameToClass(g.Key)}.cs", sb.ToString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Class( string classname, SteamApiDefinition.MethodDef[] methodDef )
|
||||||
|
{
|
||||||
|
StartBlock( $"public unsafe class {InterfaceNameToClass(classname)} : IDisposable" );
|
||||||
|
{
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "// Holds a platform specific implentation" );
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "internal Platform.Interface _pi;" );
|
||||||
|
WriteLine();
|
||||||
|
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "// Constructor decides which implementation to use based on current platform" );
|
||||||
|
WriteLine( "//" );
|
||||||
|
StartBlock( $"public {InterfaceNameToClass( classname )}( IntPtr pointer )" );
|
||||||
|
{
|
||||||
|
WriteLine( "if ( Platform.IsWindows64 ) _pi = new Platform.Win64( pointer );" );
|
||||||
|
WriteLine( "else if ( Platform.IsWindows32 ) _pi = new Platform.Win32( pointer );" );
|
||||||
|
WriteLine( "else if ( Platform.IsLinux32 ) _pi = new Platform.Linux32( pointer );" );
|
||||||
|
WriteLine( "else if ( Platform.IsLinux64 ) _pi = new Platform.Linux64( pointer );" );
|
||||||
|
WriteLine( "else if ( Platform.IsOsx ) _pi = new Platform.Mac( pointer );" );
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
WriteLine();
|
||||||
|
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "// Class is invalid if we don't have a valid implementation" );
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "public bool IsValid{ get{ return _pi != null && _pi.IsValid; } }" );
|
||||||
|
WriteLine();
|
||||||
|
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "// When shutting down clear all the internals to avoid accidental use" );
|
||||||
|
WriteLine( "//" );
|
||||||
|
StartBlock( $"public virtual void Dispose()" );
|
||||||
|
{
|
||||||
|
StartBlock( " if ( _pi != null )" );
|
||||||
|
{
|
||||||
|
WriteLine( "_pi.Dispose();" );
|
||||||
|
WriteLine( "_pi = null;" );
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
WriteLine();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Methods
|
||||||
|
//
|
||||||
|
foreach ( var m in methodDef )
|
||||||
|
{
|
||||||
|
ClassMethod( classname, m );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void ClassMethod( string classname, SteamApiDefinition.MethodDef m )
|
private void ClassMethod( string classname, SteamApiDefinition.MethodDef m )
|
||||||
{
|
{
|
||||||
var argList = BuildArguments( m.Params );
|
var argList = BuildArguments( m.Params );
|
@ -15,7 +15,7 @@ void PlatformInterface()
|
|||||||
{
|
{
|
||||||
StartBlock( $"internal static partial class Platform" );
|
StartBlock( $"internal static partial class Platform" );
|
||||||
{
|
{
|
||||||
StartBlock( $"public interface Interface" );
|
StartBlock( $"public interface Interface : IDisposable" );
|
||||||
{
|
{
|
||||||
WriteLine( "// Implementation should return true if _ptr is non null" );
|
WriteLine( "// Implementation should return true if _ptr is non null" );
|
||||||
WriteLine( "bool IsValid { get; } " );
|
WriteLine( "bool IsValid { get; } " );
|
||||||
@ -24,11 +24,7 @@ void PlatformInterface()
|
|||||||
|
|
||||||
foreach ( var m in def.methods.OrderBy( x => x.ClassName ) )
|
foreach ( var m in def.methods.OrderBy( x => x.ClassName ) )
|
||||||
{
|
{
|
||||||
if ( m.ClassName == "ISteamMatchmakingPingResponse" ) continue;
|
if ( ShouldIgnoreClass( m.ClassName ) ) continue;
|
||||||
if ( m.ClassName == "ISteamMatchmakingServerListResponse" ) continue;
|
|
||||||
if ( m.ClassName == "ISteamMatchmakingPlayersResponse" ) continue;
|
|
||||||
if ( m.ClassName == "ISteamMatchmakingRulesResponse" ) continue;
|
|
||||||
if ( m.ClassName == "ISteamMatchmakingPingResponse" ) continue;
|
|
||||||
|
|
||||||
PlatformInterfaceMethod( m );
|
PlatformInterfaceMethod( m );
|
||||||
}
|
}
|
||||||
|
34
Generator/CodeWriter/Utility.cs
Normal file
34
Generator/CodeWriter/Utility.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Generator
|
||||||
|
{
|
||||||
|
public partial class CodeWriter
|
||||||
|
{
|
||||||
|
static string[] IgnoredClasses = new string[]
|
||||||
|
{
|
||||||
|
"ISteamMatchmakingPingResponse",
|
||||||
|
"ISteamMatchmakingServerListResponse",
|
||||||
|
"ISteamMatchmakingPlayersResponse",
|
||||||
|
"ISteamMatchmakingRulesResponse",
|
||||||
|
"ISteamMatchmakingPingResponse",
|
||||||
|
};
|
||||||
|
|
||||||
|
public static bool ShouldIgnoreClass( string name )
|
||||||
|
{
|
||||||
|
return IgnoredClasses.Contains( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
public string InterfaceNameToClass( string name )
|
||||||
|
{
|
||||||
|
if ( name[0] == 'I' )
|
||||||
|
name = name.Substring( 1 );
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -48,11 +48,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Argument.cs" />
|
<Compile Include="Argument.cs" />
|
||||||
<Compile Include="CodeWriter\CodeWriter.Classes.cs" />
|
<Compile Include="CodeWriter\Class.cs" />
|
||||||
<Compile Include="CodeWriter.cs" />
|
<Compile Include="CodeWriter.cs" />
|
||||||
<Compile Include="CodeWriter.Enum.cs" />
|
<Compile Include="CodeWriter.Enum.cs" />
|
||||||
<Compile Include="CodeWriter.Struct.cs" />
|
<Compile Include="CodeWriter.Struct.cs" />
|
||||||
<Compile Include="CodeWriter.Types.cs" />
|
<Compile Include="CodeWriter.Types.cs" />
|
||||||
|
<Compile Include="CodeWriter\Utility.cs" />
|
||||||
<Compile Include="CodeWriter\Interface.cs" />
|
<Compile Include="CodeWriter\Interface.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user