reset capacity, length on depool

This commit is contained in:
Garry Newman 2016-11-08 11:13:04 +00:00
parent d8a25afb46
commit 019d46580e
2 changed files with 42 additions and 0 deletions

View File

@ -20,6 +20,7 @@ namespace Facepunch.Steamworks.Test
Assert.IsTrue( client.IsValid ); Assert.IsTrue( client.IsValid );
var Query = client.Workshop.CreateQuery(); var Query = client.Workshop.CreateQuery();
Query.Order = Workshop.Order.RankedByTrend;
Query.Run(); Query.Run();
@ -66,6 +67,44 @@ namespace Facepunch.Steamworks.Test
} }
} }
[TestMethod]
public void QueryMyFiles()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
var Query = client.Workshop.CreateQuery();
Query.UserId = client.SteamId;
Query.UserQueryType = Workshop.UserQueryType.Published;
Query.Run();
// Block, wait for result
// (don't do this in realtime)
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "\t WebsiteViews: {0}", item.WebsiteViews );
Console.WriteLine( "\t VotesUp: {0}", item.VotesUp );
Console.WriteLine( "\t PreviewUrl: {0}", item.PreviewImageUrl );
Console.WriteLine( "\t Directory: {0}", item.Directory );
Assert.IsTrue( item.PreviewImageUrl.Contains( "http" ) );
}
}
}
[TestMethod] [TestMethod]
public void QueryTagRequire() public void QueryTagRequire()
{ {

View File

@ -31,6 +31,9 @@ namespace SteamNative
if ( StringBuilderPoolIndex >= StringBuilderPool.Length ) if ( StringBuilderPoolIndex >= StringBuilderPool.Length )
StringBuilderPoolIndex = 0; StringBuilderPoolIndex = 0;
StringBuilderPool[StringBuilderPoolIndex].Capacity = 4096;
StringBuilderPool[StringBuilderPoolIndex].Length = 0;
return StringBuilderPool[StringBuilderPoolIndex]; return StringBuilderPool[StringBuilderPoolIndex];
} }
} }