Ugc.Editor.WithTag

This commit is contained in:
Garry Newman 2019-05-07 16:38:54 +01:00
parent a82a56bd4c
commit 43c3aa35f5
2 changed files with 22 additions and 0 deletions

View File

@ -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 );

View File

@ -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<string> Tags;
public Editor WithTag( string tag )
{
if ( Tags == null ) Tags = new List<string>();
Tags.Add( tag );
return this;
}
public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
{
var result = default( PublishResult );
@ -101,6 +112,14 @@ public async Task<PublishResult> SubmitAsync( IProgress<float> 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;