mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +03:00
Added SteamUGC.FetchItem
This commit is contained in:
parent
eceeb2cb8f
commit
966ad90630
@ -44,5 +44,24 @@ public static bool Download( PublishedFileId fileId, bool highPriority = false )
|
||||
{
|
||||
return Internal.DownloadItem( fileId, highPriority );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Utility function to fetch a single item. Internally this uses Ugc.FileQuery -
|
||||
/// which you can use to query multiple items if you need to.
|
||||
/// </summary>
|
||||
public static async Task<Ugc.Item?> FetchItem( PublishedFileId fileId )
|
||||
{
|
||||
var result = await new Ugc.FileQuery( fileId )
|
||||
.GetPageAsync( 1 );
|
||||
|
||||
if ( !result.HasValue || result.Value.ResultCount != 1 )
|
||||
return null;
|
||||
|
||||
var item = result.Value.Entries.First();
|
||||
|
||||
result.Value.Dispose();
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user