mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-29 15:08:10 +03:00
Steamworks.Ugc.Item.GetAsync
This commit is contained in:
parent
f42fdfd09a
commit
fd320e2848
@ -21,7 +21,7 @@ namespace Steamworks
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetInformation()
|
public async Task GetInformation()
|
||||||
{
|
{
|
||||||
var itemInfo = await Ugc.Item.Get( 1720164672 );
|
var itemInfo = await Ugc.Item.GetAsync( 1720164672 );
|
||||||
|
|
||||||
Assert.IsTrue( itemInfo.HasValue );
|
Assert.IsTrue( itemInfo.HasValue );
|
||||||
|
|
||||||
|
@ -11,11 +11,18 @@ namespace Steamworks.Ugc
|
|||||||
public struct Item
|
public struct Item
|
||||||
{
|
{
|
||||||
internal SteamUGCDetails_t details;
|
internal SteamUGCDetails_t details;
|
||||||
|
internal PublishedFileId _id;
|
||||||
|
|
||||||
|
public Item( PublishedFileId id ) : this()
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The actual ID of this file
|
/// The actual ID of this file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PublishedFileId Id => details.PublishedFileId;
|
public PublishedFileId Id => _id;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The given title of this item
|
/// The given title of this item
|
||||||
@ -117,7 +124,7 @@ namespace Steamworks.Ugc
|
|||||||
|
|
||||||
private ItemState State => (ItemState) SteamUGC.Internal.GetItemState( Id );
|
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 );
|
var result = await SteamUGC.Internal.RequestUGCDetails( id, (uint) maxageseconds );
|
||||||
if ( !result.HasValue ) return null;
|
if ( !result.HasValue ) return null;
|
||||||
@ -129,6 +136,7 @@ namespace Steamworks.Ugc
|
|||||||
{
|
{
|
||||||
var d = new Item
|
var d = new Item
|
||||||
{
|
{
|
||||||
|
_id = details.PublishedFileId,
|
||||||
details = details,
|
details = details,
|
||||||
Tags = details.Tags.ToLower().Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries )
|
Tags = details.Tags.ToLower().Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries )
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user