Steamworks.NET Extension for .NET 8+, ValueTask callbacks for example. This project is aimed to adapt regular .NET8+ projects's idiom based on `Steamworks.NET`. Extended features list: Convert call-result to ValueTask<TResult>. Spawn automatic steam callback dispatcher thread. Fluent UGC query builder and query result wrapper.
$ dotnet add package FaGe.Steamworks.NET.ExtensionsAs you can see, this project is aimed to extend modern features to Steamworks.NET on regular .NET projects that targeting to up to date framework.
await, achived by ToValueTask<T>() extension method series on SteamAPICall_t.
These methods build on top of original CallResult<T> and can be accessed by using namespace FaGe.Steamworks.NET.Extensions. In current version, there are 2 variants.
ToValueTask<T>() is suitable for those call-results that don't considering cancellation.
Example:
var queryResult = await SteamUGC.SendQueryUGCRequest(queryHandle).ToValueTask<SteamUGCQueryCompleted_t>();
ToValueTaskWithCancellation<T>() returns a ValueTask<T> and carry out a CancellationTokenSource by the way,
you can later cancel this operation by that CancellationTokenSource. Example:
// do async operation
var result = SteamUGC.SendQueryUGCRequest(queryHandle).ToValueTaskWithCancellation<SteamUGCQueryCompleted_t>(out var ctsInSomeField);
// somewhere else that want to cancel
ctsInSomeField.Cancel()
SteamCallbackDispatch.Singleton.SpawnCallbackDispatchThread() method.
CancellationTokenSource. SteamCallbackDispatch.Singleton.StopDispatchSource is also the same.
Beware, once the thread is stopped, it can't be restarted.FaGe.Steamworks.NET.Extensions