SteamQuery.NET 1.1.2

dotnet add package SteamQuery.NET --version 1.1.2                
NuGet\Install-Package SteamQuery.NET -Version 1.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SteamQuery.NET" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SteamQuery.NET --version 1.1.2                
#r "nuget: SteamQuery.NET, 1.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SteamQuery.NET as a Cake Addin
#addin nuget:?package=SteamQuery.NET&version=1.1.2

// Install SteamQuery.NET as a Cake Tool
#tool nuget:?package=SteamQuery.NET&version=1.1.2                

NuGet Version (SteamQuery.NET) NuGet Downloads (SteamQuery.NET)

SteamQuery.NET

Yet another Steam server queries .NET wrapper.

Supports Source, GoldSource, and obsolete GoldSource protocols.

Usage Example

You can check the ExampleApplication project!

var server = new GameServer("127.0.0.1:27015");

await server.PerformQueryAsync();

Console.WriteLine($"Server Name: {server.Information.ServerName}"); // Server Name: [TR] AnneTokatlayan Pro Public
Console.WriteLine($"Players: {server.Information.OnlinePlayers}/{server.Information.MaxPlayers}"); // Players: 13/37
Console.WriteLine($"Rule Count: {server.Rules.Count}"); // Rule Count: 420

server.Close();

Or instead of performing all queries, you can specify which queries should be performed and also use custom timeouts;

var server = new GameServer("127.0.0.1:27015")
{
    SendTimeout = 1337,
    ReceiveTimeout = 7331
};

await server.PerformQueryAsync(SteamQueryA2SQuery.Information | SteamQueryA2SQuery.Rules);

Console.WriteLine($"Server Name: {server.Information.ServerName}"); // Server Name: [TR] AnneTokatlayan Pro Public
Console.WriteLine($"Players: {server.Players.Count}/{server.MaxPlayers}"); // Output will be like "Players: 0/31" because you did not perform the Players query.
Console.WriteLine($"Rule Count: {server.Rules.Count}"); // Rule Count: 420

server.Close();

Or you can use using keyword to let .NET take care of the disposal process of server object;

using var server = new GameServer("127.0.0.1", 27015);

var information = await server.GetInformationAsync();
Console.WriteLine($"Server Name: {information.ServerName}"); // Server Name: [TR] AnneTokatlayan Pro Public

var players = await server.GetPlayersAsync();
Console.WriteLine($"Players: {players.Count}/{information.MaxPlayers}"); // Players: 13/37

var rules = await server.GetRulesAsync();
foreach (var rule in rules)
{
    Console.WriteLine($"{rule.Name} = {rule.Value}");
}

You can also use a host name, instead of IP address. And also the synchronous methods!

using var server = new GameServer("localhost:27015");

var information = server.GetInformation();

Console.WriteLine($"Server Name: {information.ServerName}"); // Server Name: [TR] AnneTokatlayan Pro Public

FYI: Before you perform any queries, related properties will have default values.

using var server = new GameServer("localhost:27015");

Console.WriteLine($"Server Name: {server.Information.ServerName}"); // Output will be like "Server Name: " because you did not perform the Information query.

var information await server.GetInformationAsync();

Console.WriteLine($"Server Name: {server.Information.ServerName}"); // Server Name: [TR] AnneTokatlayan Pro Public
Console.WriteLine($"Server Name: {information.ServerName}"); // Server Name: [TR] AnneTokatlayan Pro Public

Supported Frameworks

❌ Not Supported ✅ Supported
.NET 5.0-8.0
.NET Core 1.0-1.1 2.0-3.1
.NET Framework<sup>[1]</sup> 1.0-4.6 4.6.1<sup>[2]</sup>-4.8.1

[1]

The versions listed for .NET Framework apply to .NET Core 2.0 SDK and later versions of the tooling. Older versions used a different mapping for .NET Standard 1.5 and higher.

[2]

The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.

To-Do

  • bzip2 decompression. (It's kind of implemented. I just couldn't find any server that uses bzip2 compression. If you know any, just hit me up. I'd appreciate it.)
  • Master Server Query Protocol.
  • Source RCON Protocol.

For More Information

If you want to learn more about Steam's server queries and their weird behaviors, check Steam server queries developer community page and talk page about it.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2 435 5/20/2024
1.1.1 593 2/9/2024
1.1.0 150 2/9/2024
1.0.2 116 2/7/2024
1.0.1 120 2/6/2024
1.0.0 118 2/6/2024