mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-16 00:28:22 +03:00
Added SteamUGC.FetchItem
This commit is contained in:
parent
eceeb2cb8f
commit
966ad90630
@ -44,5 +44,24 @@ namespace Steamworks
|
|||||||
{
|
{
|
||||||
return Internal.DownloadItem( fileId, highPriority );
|
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…
x
Reference in New Issue
Block a user