From af36007f5d9213c9842eaa3cbdfbbb078087f0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Halld=C3=A9n?= Date: Sat, 30 May 2020 21:32:19 +0200 Subject: [PATCH] Support return UGC metadata in query --- Facepunch.Steamworks/Structs/UgcItem.cs | 13 +++++++++---- Facepunch.Steamworks/Structs/UgcQuery.cs | 1 + Facepunch.Steamworks/Structs/UgcResultPage.cs | 12 ++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Facepunch.Steamworks/Structs/UgcItem.cs b/Facepunch.Steamworks/Structs/UgcItem.cs index 4eeaca9..680e5a6 100644 --- a/Facepunch.Steamworks/Structs/UgcItem.cs +++ b/Facepunch.Steamworks/Structs/UgcItem.cs @@ -365,10 +365,15 @@ public async Task RemoveFavorite() public ulong NumSecondsPlayedDuringTimePeriod { get; internal set; } public ulong NumPlaytimeSessionsDuringTimePeriod { get; internal set; } - /// - /// The URL to the preview image for this item - /// - public string PreviewImageUrl { get; internal set; } + /// + /// The URL to the preview image for this item + /// + public string PreviewImageUrl { get; internal set; } + + /// + /// The metadata string for this item + /// + public string Metadata { get; internal set; } /// /// Edit this item diff --git a/Facepunch.Steamworks/Structs/UgcQuery.cs b/Facepunch.Steamworks/Structs/UgcQuery.cs index cca9874..7401225 100644 --- a/Facepunch.Steamworks/Structs/UgcQuery.cs +++ b/Facepunch.Steamworks/Structs/UgcQuery.cs @@ -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, }; } diff --git a/Facepunch.Steamworks/Structs/UgcResultPage.cs b/Facepunch.Steamworks/Structs/UgcResultPage.cs index 41ed08c..86a6e2b 100644 --- a/Facepunch.Steamworks/Structs/UgcResultPage.cs +++ b/Facepunch.Steamworks/Structs/UgcResultPage.cs @@ -14,6 +14,7 @@ public struct ResultPage : System.IDisposable internal bool ReturnsKeyValueTags; internal bool ReturnsDefaultStats; + internal bool ReturnsMetadata; public IEnumerable Entries { @@ -63,10 +64,17 @@ public IEnumerable 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; }