Support return UGC metadata in query

This commit is contained in:
Max Halldén 2020-05-30 21:32:19 +02:00
parent ed45805029
commit af36007f5d
3 changed files with 20 additions and 6 deletions

View File

@ -365,10 +365,15 @@ public async Task<bool> RemoveFavorite()
public ulong NumSecondsPlayedDuringTimePeriod { get; internal set; }
public ulong NumPlaytimeSessionsDuringTimePeriod { get; internal set; }
/// <summary>
/// The URL to the preview image for this item
/// </summary>
public string PreviewImageUrl { get; internal set; }
/// <summary>
/// The URL to the preview image for this item
/// </summary>
public string PreviewImageUrl { get; internal set; }
/// <summary>
/// The metadata string for this item
/// </summary>
public string Metadata { get; internal set; }
/// <summary>
/// Edit this item

View File

@ -151,6 +151,7 @@ public Query WithFileId( params PublishedFileId[] files )
CachedData = result.Value.CachedData,
ReturnsKeyValueTags = WantsReturnKeyValueTags ?? false,
ReturnsDefaultStats = WantsDefaultStats ?? true, //true by default
ReturnsMetadata = WantsReturnMetadata ?? false,
};
}

View File

@ -14,6 +14,7 @@ public struct ResultPage : System.IDisposable
internal bool ReturnsKeyValueTags;
internal bool ReturnsDefaultStats;
internal bool ReturnsMetadata;
public IEnumerable<Item> Entries
{
@ -63,10 +64,17 @@ public IEnumerable<Item> Entries
}
}
if (ReturnsMetadata)
{
string metadata;
if (SteamUGC.Internal.GetQueryUGCMetadata(Handle, i, out metadata))
{
item.Metadata = metadata;
}
}
// TODO GetQueryUGCAdditionalPreview
// TODO GetQueryUGCChildren
// TODO GetQueryUGCMetadata
yield return item;
}