OpenGSQ 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package OpenGSQ --version 1.3.0                
NuGet\Install-Package OpenGSQ -Version 1.3.0                
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="OpenGSQ" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpenGSQ --version 1.3.0                
#r "nuget: OpenGSQ, 1.3.0"                
#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 OpenGSQ as a Cake Addin
#addin nuget:?package=OpenGSQ&version=1.3.0

// Install OpenGSQ as a Cake Tool
#tool nuget:?package=OpenGSQ&version=1.3.0                

OpenGSQ .NET Library

The OpenGSQ .NET library provides a convenient way to query servers from applications written in the C# language.

Installation

Find the package through NuGet Package Manager or install it with following command.

dotnet add package OpenGSQ

Usage

Source Query Protocol

using System;
using OpenGSQ.Protocols;

namespace OpenGSQExample
{
    class Program
    {
        static void Main(string[] args)
        {
            Source source = new Source("91.216.250.14", 27015);

            // Get Server Info
            Source.IResponse response = source.GetInfo();
           
            Console.WriteLine(response.Name); // skial.com | SAXTON HALE | US ███
            Console.WriteLine(response.Map);  // vsh_dust_showdown_deluxe_r1

            // If you want to get full response, try cast to SourceResponse or GoldSourceResponse
            if (response is Source.SourceResponse sourceResponse)
            {
                // Casted from IResponse to SourceResponse

                Console.WriteLine(sourceResponse.ID); // 440
            }
            else if (response is Source.GoldSourceResponse goldSourceResponse)
            {
                // Casted from IResponse to GoldSourceResponse

                Console.WriteLine(goldSourceResponse.Address);
            }
        }
    }
}

Source RCON Protocol

using System;
using OpenGSQ.Protocols;

namespace OpenGSQExample
{
    class Program
    {
        static void Main(string[] args)
        {
            using var remoteConsole = new Source.RemoteConsole("", 27015);

            try
            {
                // Authenticate with rcon password
                remoteConsole.Authenticate("");

                // Send command and receive the response
                string response = remoteConsole.SendCommand("cvarlist");

                Console.WriteLine(response);
            }
            catch (Exception e)
            {
                Console.WriteLine($"{e.Message}");
            }
        }
    }
}

Supported Protocols

var gameSpy1 = new GameSpy1("123.123.123.123", 7778);
var gameSpy2 = new GameSpy2("123.123.123.123", 23000);
var gameSpy3 = new GameSpy3("123.123.123.123", 29900);
var gameSpy4 = new GameSpy4("123.123.123.123", 19132);
var quake1 = new Quake1("123.123.123.123", 27500);
var quake2 = new Quake2("123.123.123.123", 27910);
var quake3 = new Quake3("123.123.123.123", 27960);
var source = new Source("123.123.123.123", 27015); // Both Source and Goldsource supported

See OpenGSQTests/Protocols for the tests.

See OpenGSQTests/Results for tests outputs.

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 was computed.  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
2.1.5 292 2/7/2024
2.1.4 114 2/5/2024
2.1.3 121 1/29/2024
2.1.2 113 1/26/2024
2.1.1 121 1/21/2024
2.1.0 111 1/20/2024
2.0.1 117 1/18/2024
2.0.0 102 1/18/2024
1.3.0 928 1/13/2022
1.2.0 390 10/31/2021
1.1.1 372 7/4/2021
1.0.1 307 6/4/2021