diff --git a/Facepunch.Steamworks.Test/Server/Stats.cs b/Facepunch.Steamworks.Test/Server/Stats.cs
index df50056..8847a40 100644
--- a/Facepunch.Steamworks.Test/Server/Stats.cs
+++ b/Facepunch.Steamworks.Test/Server/Stats.cs
@@ -29,11 +29,8 @@ namespace Facepunch.Steamworks.Test
Assert.IsTrue( deathsInCallback > 0 );
} );
- while ( !GotStats )
- {
- server.Update();
- Thread.Sleep( 10 );
- }
+
+ server.UpdateWhile( () => !GotStats );
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
Console.WriteLine( "deathsInCallback: {0}", deaths );
diff --git a/Facepunch.Steamworks.Test/bin/Debug/Facepunch.Steamworks.xml b/Facepunch.Steamworks.Test/bin/Debug/Facepunch.Steamworks.xml
index 8bb7daa..683812b 100644
--- a/Facepunch.Steamworks.Test/bin/Debug/Facepunch.Steamworks.xml
+++ b/Facepunch.Steamworks.Test/bin/Debug/Facepunch.Steamworks.xml
@@ -14,6 +14,13 @@
Called with a message from Steam
+
+
+ Run Update until func returns false.
+ This will cause your program to lock up until it finishes.
+ This is useful for things like tests or command line utilities etc.
+
+
An item in your inventory.
diff --git a/Facepunch.Steamworks/BaseSteamworks.cs b/Facepunch.Steamworks/BaseSteamworks.cs
index 55dd17e..6e5cacf 100644
--- a/Facepunch.Steamworks/BaseSteamworks.cs
+++ b/Facepunch.Steamworks/BaseSteamworks.cs
@@ -94,5 +94,19 @@ namespace Facepunch.Steamworks
if ( OnUpdate != null )
OnUpdate();
}
+
+ ///
+ /// Run Update until func returns false.
+ /// This will cause your program to lock up until it finishes.
+ /// This is useful for things like tests or command line utilities etc.
+ ///
+ public void UpdateWhile( Func func )
+ {
+ while ( func() )
+ {
+ Update();
+ System.Threading.Thread.Sleep( 1 );
+ }
+ }
}
}
\ No newline at end of file