Steamworks.Ugc.Item.GetAsync

This commit is contained in:
Garry Newman 2019-05-07 16:28:35 +01:00
parent f42fdfd09a
commit fd320e2848
2 changed files with 11 additions and 3 deletions

View File

@ -21,7 +21,7 @@ public async Task Download()
[TestMethod]
public async Task GetInformation()
{
var itemInfo = await Ugc.Item.Get( 1720164672 );
var itemInfo = await Ugc.Item.GetAsync( 1720164672 );
Assert.IsTrue( itemInfo.HasValue );

View File

@ -11,11 +11,18 @@ namespace Steamworks.Ugc
public struct Item
{
internal SteamUGCDetails_t details;
internal PublishedFileId _id;
public Item( PublishedFileId id ) : this()
{
_id = id;
}
/// <summary>
/// The actual ID of this file
/// </summary>
public PublishedFileId Id => details.PublishedFileId;
public PublishedFileId Id => _id;
/// <summary>
/// The given title of this item
@ -117,7 +124,7 @@ public bool Download( bool highPriority = false )
private ItemState State => (ItemState) SteamUGC.Internal.GetItemState( Id );
public static async Task<Item?> Get( PublishedFileId id, int maxageseconds = 60 * 30 )
public static async Task<Item?> GetAsync( PublishedFileId id, int maxageseconds = 60 * 30 )
{
var result = await SteamUGC.Internal.RequestUGCDetails( id, (uint) maxageseconds );
if ( !result.HasValue ) return null;
@ -129,6 +136,7 @@ internal static Item From( SteamUGCDetails_t details )
{
var d = new Item
{
_id = details.PublishedFileId,
details = details,
Tags = details.Tags.ToLower().Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries )
};