Merge pull request #441 from maxha651/master

Support return UGC metadata in query
This commit is contained in:
Garry Newman 2020-06-07 10:55:30 +01:00 committed by GitHub
commit de69dd228f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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, only available from queries WithMetadata(true)
/// </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;
}