diff --git a/Facepunch.Steamworks.Test/UgcEditor.cs b/Facepunch.Steamworks.Test/UgcEditor.cs index 27427e1..801e8d4 100644 --- a/Facepunch.Steamworks.Test/UgcEditor.cs +++ b/Facepunch.Steamworks.Test/UgcEditor.cs @@ -20,6 +20,9 @@ public async Task CreateFile() .WithDescription( "This item was created by Facepunch Steamworks unit tests.\n\n" + "It should have technically been deleted so you should never get to " + "read this unless something terrible has happened." ) + .WithTag( "Arsehole" ) + .WithTag( "Spiteful" ) + .WithTag( "Fat-Head" ) .SubmitAsync(); Assert.IsTrue( result.Success ); diff --git a/Facepunch.Steamworks/Structs/UgcEditor.cs b/Facepunch.Steamworks/Structs/UgcEditor.cs index d59f0c9..2a8e5f4 100644 --- a/Facepunch.Steamworks/Structs/UgcEditor.cs +++ b/Facepunch.Steamworks/Structs/UgcEditor.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Steamworks.Data; @@ -55,6 +56,16 @@ internal Editor( WorkshopFileType filetype ) : this() public Editor WithContent( string folderName ) { return WithContent( new System.IO.DirectoryInfo( folderName ) ); } + List Tags; + public Editor WithTag( string tag ) + { + if ( Tags == null ) Tags = new List(); + + Tags.Add( tag ); + + return this; + } + public async Task SubmitAsync( IProgress progress = null ) { var result = default( PublishResult ); @@ -101,6 +112,14 @@ public async Task SubmitAsync( IProgress progress = null ) if ( Language != null ) SteamUGC.Internal.SetItemUpdateLanguage( handle, Language ); if ( ContentFolder != null ) SteamUGC.Internal.SetItemContent( handle, ContentFolder.FullName ); if ( PreviewFile != null ) SteamUGC.Internal.SetItemPreview( handle, PreviewFile ); + if ( Tags != null && Tags.Count > 0 ) + { + using ( var a = SteamParamStringArray.From( Tags.ToArray() ) ) + { + var val = a.Value; + SteamUGC.Internal.SetItemTags( handle, ref val ); + } + } result.Result = Steamworks.Result.Fail;