mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-26 05:28:07 +03:00
Added Dispatch.OnException
This commit is contained in:
parent
c24b247094
commit
b265084d18
@ -22,7 +22,7 @@ namespace Steamworks
|
|||||||
Console.WriteLine( $"" );
|
Console.WriteLine( $"" );
|
||||||
};
|
};
|
||||||
|
|
||||||
Steamworks.SteamClient.OnCallbackException = ( e ) =>
|
Steamworks.Dispatch.OnException = ( e ) =>
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine( e.Message );
|
Console.Error.WriteLine( e.Message );
|
||||||
Console.Error.WriteLine( e.StackTrace );
|
Console.Error.WriteLine( e.StackTrace );
|
||||||
|
@ -103,7 +103,7 @@ namespace Steamworks
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task NetAddressTest()
|
public void NetAddressTest()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
var n = NetAddress.From( "127.0.0.1", 12445 );
|
var n = NetAddress.From( "127.0.0.1", 12445 );
|
||||||
|
@ -27,6 +27,14 @@ namespace Steamworks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static Action<CallbackType, string, bool> OnDebugCallback;
|
public static Action<CallbackType, string, bool> OnDebugCallback;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called if an exception happens during a callback/callresult.
|
||||||
|
/// This is needed because the exception isn't always accessible when running
|
||||||
|
/// async.. and can fail silently. With this hooked you won't be stuck wondering
|
||||||
|
/// what happened.
|
||||||
|
/// </summary>
|
||||||
|
public static Action<Exception> OnException;
|
||||||
|
|
||||||
#region interop
|
#region interop
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_Init", CallingConvention = CallingConvention.Cdecl )]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_Init", CallingConvention = CallingConvention.Cdecl )]
|
||||||
internal static extern void SteamAPI_ManualDispatch_Init();
|
internal static extern void SteamAPI_ManualDispatch_Init();
|
||||||
@ -99,6 +107,10 @@ namespace Steamworks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch ( System.Exception e )
|
||||||
|
{
|
||||||
|
OnException?.Invoke( e );
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
runningFrame = false;
|
runningFrame = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user