mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Add support for 1:many KeyValueTags
This commit is contained in:
parent
4463739be5
commit
8afce3665f
@ -42,7 +42,7 @@ public Item( PublishedFileId id ) : this()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A dictionary of key value tags for this item, only available from queries WithKeyValueTags(true)
|
/// A dictionary of key value tags for this item, only available from queries WithKeyValueTags(true)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string,string> KeyValueTags { get; internal set; }
|
public Dictionary<string,List<string>> KeyValueTags { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// App Id of the app that created this item
|
/// App Id of the app that created this item
|
||||||
|
@ -57,12 +57,20 @@ public IEnumerable<Item> Entries
|
|||||||
{
|
{
|
||||||
var keyValueTagsCount = SteamUGC.Internal.GetQueryUGCNumKeyValueTags( Handle, i );
|
var keyValueTagsCount = SteamUGC.Internal.GetQueryUGCNumKeyValueTags( Handle, i );
|
||||||
|
|
||||||
item.KeyValueTags = new Dictionary<string, string>( (int)keyValueTagsCount );
|
item.KeyValueTags = new Dictionary<string, List<string>>( (int)keyValueTagsCount );
|
||||||
for ( uint j = 0; j < keyValueTagsCount; j++ )
|
for ( uint j = 0; j < keyValueTagsCount; j++ )
|
||||||
{
|
{
|
||||||
string key, value;
|
string key, value;
|
||||||
if ( SteamUGC.Internal.GetQueryUGCKeyValueTag( Handle, i, j, out key, out value ) )
|
if ( SteamUGC.Internal.GetQueryUGCKeyValueTag( Handle, i, j, out key, out value ) )
|
||||||
item.KeyValueTags[key] = value;
|
{
|
||||||
|
if ( !item.KeyValueTags.TryGetValue( key, out List<string> list ) )
|
||||||
|
{
|
||||||
|
list = new List<string>();
|
||||||
|
item.KeyValueTags[key] = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Add(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,4 +139,4 @@ public void Dispose()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user