diff --git a/Facepunch.Steamworks.Test/Client/ServerlistTest.cs b/Facepunch.Steamworks.Test/Client/ServerlistTest.cs index 9f5b413..c96c19c 100644 --- a/Facepunch.Steamworks.Test/Client/ServerlistTest.cs +++ b/Facepunch.Steamworks.Test/Client/ServerlistTest.cs @@ -406,9 +406,10 @@ public void Rules() filter.Add( "gamedir", "rust" ); filter.Add( "secure", "1" ); + filter.Add( "addr", "185.97.254.146" ); + using ( var query = client.ServerList.Internet( filter ) ) { - for ( int i = 0; i < 1000; i++ ) { GC.Collect(); @@ -416,8 +417,8 @@ public void Rules() GC.Collect(); System.Threading.Thread.Sleep( 10 ); - if ( query.Responded.Count > 20 ) - break; + // if ( query.Responded.Count > 20 ) + // break; if ( query.Finished ) break; @@ -425,15 +426,12 @@ public void Rules() query.Dispose(); - var servers = query.Responded.Take( 10 ); - - foreach ( var server in servers ) - { - server.FetchRules(); - } + var servers = query.Responded.Take( 100 ); foreach ( var server in servers ) { + server.FetchRules(); + int i = 0; while ( !server.HasRules ) { @@ -447,7 +445,10 @@ public void Rules() if ( server.HasRules ) { - Console.WriteLine( "SERVER HAS RULES :D" ); + Console.WriteLine( "" ); + Console.WriteLine( "" ); + Console.WriteLine( server.Address ); + Console.WriteLine( "" ); foreach ( var rule in server.Rules ) { diff --git a/Facepunch.Steamworks/Utility.cs b/Facepunch.Steamworks/Utility.cs index 1b86696..1bb7e43 100644 --- a/Facepunch.Steamworks/Utility.cs +++ b/Facepunch.Steamworks/Utility.cs @@ -79,7 +79,7 @@ internal static string FormatPrice(string currency, ulong price) } } - public static string ReadAnsiString( this BinaryReader br, byte[] buffer = null ) + public static string ReadNullTerminatedUTF8String( this BinaryReader br, byte[] buffer = null ) { if ( buffer == null ) buffer = new byte[1024]; @@ -92,7 +92,7 @@ public static string ReadAnsiString( this BinaryReader br, byte[] buffer = null i++; } - return Encoding.ASCII.GetString( buffer, 0, i ); + return Encoding.UTF8.GetString( buffer, 0, i ); } } diff --git a/Facepunch.Steamworks/Utility/SourceServerQuery.cs b/Facepunch.Steamworks/Utility/SourceServerQuery.cs index e831ac8..fa8c3a5 100644 --- a/Facepunch.Steamworks/Utility/SourceServerQuery.cs +++ b/Facepunch.Steamworks/Utility/SourceServerQuery.cs @@ -100,7 +100,7 @@ void GetRules() var numRules = br.ReadUInt16(); for ( int index = 0; index < numRules; index++ ) { - rules.Add( br.ReadAnsiString( readBuffer ), br.ReadAnsiString( readBuffer ) ); + rules.Add( br.ReadNullTerminatedUTF8String( readBuffer ), br.ReadNullTerminatedUTF8String( readBuffer ) ); } }