### Complete Server Monitoring Example (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt A comprehensive C# example demonstrating server querying, RCON control, and real-time log monitoring for a game server. It connects to a server, retrieves information like name, map, and player count, executes RCON commands, and subscribes to log events such as player kills, chat messages, and connections/disconnections. Requires server IP, port, RCON password, and a log port. ```csharp using QueryMaster; using QueryMaster.GameServer; using System; using System.Threading; class ServerMonitor { static void Main(string[] args) { string serverIp = "192.168.1.100"; ushort serverPort = 27015; string rconPassword = "your_password"; ushort logPort = 27500; using (var server = ServerQuery.GetServerInstance( EngineType.Source, serverIp, serverPort, throwExceptions: true )) { // Query server info Console.WriteLine("=== Server Information ==="); ServerInfo info = server.GetInfo(); Console.WriteLine($"Name: {info.Name}"); Console.WriteLine($"Map: {info.Map}"); Console.WriteLine($"Players: {info.Players}/{info.MaxPlayers}"); Console.WriteLine($"Game: {info.Description}"); // Get players Console.WriteLine("\n=== Current Players ==="); var players = server.GetPlayers(); foreach (var player in players) { Console.WriteLine($"{player.Name} - Score: {player.Score}"); } // RCON commands Console.WriteLine("\n=== Executing RCON Commands ==="); using (Rcon rcon = server.GetControl(rconPassword)) { string status = rcon.SendCommand("status"); Console.WriteLine(status); // Enable logging and set destination rcon.Enablelogging(); rcon.AddlogAddress("192.168.1.50", logPort); } // Start log listener Console.WriteLine("\n=== Monitoring Server Logs ==="); Logs logs = server.GetLogs(logPort); LogEvents events = logs.GetEventsInstance(); events.PlayerKilled += (s, e) => Console.WriteLine($"[KILL] {e.Attacker.Name} killed {e.Victim.Name} with {e.Weapon}"); events.ChatMessage += (s, e) => Console.WriteLine($"[CHAT] {e.Player.Name}: {e.Message}"); events.PlayerConnected += (s, e) => Console.WriteLine($"[JOIN] {e.Player.Name} connected"); events.PlayerDisconnected += (s, e) => Console.WriteLine($"[LEAVE] {e.Player.Name} disconnected"); logs.Start(); // Monitor for 60 seconds Thread.Sleep(60000); logs.Stop(); Console.WriteLine("\nMonitoring stopped."); } } } ``` -------------------------------- ### Get Player List from Server Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieve detailed information about all players currently connected to a game server. ```APIDOC ## Get Player List from Server ### Description Retrieve detailed information about all players currently connected to a game server. ### Method GET (Implicit) ### Endpoint N/A (Library function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp using QueryMaster; using QueryMaster.GameServer; using (var server = ServerQuery.GetServerInstance( Game.CSGO, "play.example.com", 27015 )) { // Get all players QueryMasterCollection players = server.GetPlayers(); if (players != null) { Console.WriteLine($"Total Players: {players.Count}"); foreach (Player player in players) { Console.WriteLine($"Name: {player.Name}"); Console.WriteLine($"Score: {player.Score}"); Console.WriteLine($"Time Connected: {player.Time} seconds"); Console.WriteLine("---"); } // QueryMasterCollection supports JSON serialization string json = players.ToJson(); Console.WriteLine(json); } } ``` ### Response #### Success Response (200) - **QueryMasterCollection** (array) - A collection of Player objects, each containing Name, Score, and Time connected. #### Response Example ```json [ { "Name": "Player1", "Score": 150, "Time": 1200 }, { "Name": "Player2", "Score": 120, "Time": 950 } ] ``` ``` -------------------------------- ### Query Game Servers using Valve's Master Server (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Discover game servers by querying Valve's Master Server with optional filtering by region and server properties. This C# example utilizes the QueryMaster library to connect to the master server and retrieve a list of available game servers. It includes options for filtering by application ID, server type, and game-specific properties. ```csharp using QueryMaster; using QueryMaster.MasterServer; using System; using System.Collections.Generic; // Use predefined master server endpoints var masterServer = MasterQuery.GetServerInstance( MasterQuery.SourceServerEndPoint, // Or MasterQuery.GoldSrcServerEndPoint sendTimeout: 3000, receiveTimeout: 3000, retries: 3 ); // Track received servers List serverList = new List(); // Set up callback for received server batches masterServer.GetAddresses( Region.Europe, callback: (batchInfo) => { Console.WriteLine($"Batch {batchInfo.BatchNumber}: {batchInfo.Servers.Count} servers"); serverList.AddRange(batchInfo.Servers); foreach (var endpoint in batchInfo.Servers) { Console.WriteLine($" {endpoint.Address}:{endpoint.Port}"); } // Check if this is the last batch if (batchInfo.IsLastBatch) { Console.WriteLine($"Total servers found: {serverList.Count}"); } }, filter: new IpFilter { // Filter for specific game AppId = 730, // CS:GO // Filter for dedicated servers only IsDedicated = true, // Filter for non-empty servers NotEmpty = true, // Filter for non-full servers NotFull = true, // Filter by map Map = "de_dust2", // Additional filters IsSecure = true, GameType = "valve_ds", IsLinux = false }, batchCount: 5, // Get 5 batches (231 servers each), -1 for all errorCallback: (ex) => { Console.WriteLine($"Error: {ex.Message}"); } ); // Stop receiving if needed // masterServer.StopReceiving(); masterServer.Dispose(); ``` -------------------------------- ### Get Current Players for a Steam Game (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves the real-time number of players for a given Steam game using its AppID. Requires a Steam API key. Outputs the player count to the console. Supports querying multiple game AppIDs in a loop. ```csharp using QueryMaster; using QueryMaster.Steam; var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); // Check player count for CS:GO (AppID 730) var response = steamApi.ISteamUserStats.GetNumberOfCurrentPlayers(730); if (response != null && response.ParsedResponse != null) { Console.WriteLine($"Current Players: {response.ParsedResponse.PlayerCount:N0}"); } // Check multiple games uint[] gameIds = { 730, 440, 570, 578080 }; // CS:GO, TF2, Dota 2, PUBG foreach (uint appId in gameIds) { var result = steamApi.ISteamUserStats.GetNumberOfCurrentPlayers(appId); if (result?.ParsedResponse != null) { Console.WriteLine($"AppID {appId}: {result.ParsedResponse.PlayerCount:N0} players"); } } ``` -------------------------------- ### Steam Web API - Get Player Achievements Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves achievement data for a specific game and player from Steam. Requires a Steam API key. ```APIDOC ## Steam Web API - Get Player Achievements ### Description Retrieve achievement data for a specific game and player from Steam. ### Method POST (typically, though the library abstracts this) ### Endpoint `ISteamUserStats.GetPlayerAchievements` ### Parameters #### Query Parameters - **steamId** (long) - Required - The 64-bit Steam ID of the player. - **appId** (uint) - Required - The AppID of the game. - **language** (string) - Optional - The language to retrieve achievement data in (e.g., "en"). ### Request Example ```csharp var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); var response = steamApi.ISteamUserStats.GetPlayerAchievements( steamId: 76561198000000001, appId: 730, language: "en" ); ``` ### Response #### Success Response (200) - **ParsedResponse** (object) - Contains the parsed achievement data. - **GameName** (string) - The name of the game. - **Achievements** (array) - A list of achievements. - **Name** (string) - The name of the achievement. - **Description** (string) - The description of the achievement. - **Achieved** (int) - 1 if achieved, 0 otherwise. - **UnlockTime** (DateTime) - The time the achievement was unlocked. #### Response Example ```json { "GameName": "Counter-Strike: Global Offensive", "Achievements": [ { "Name": "The Professional", "Description": "Win 1000 competitive matches.", "Achieved": 1, "UnlockTime": "2015-01-01T12:00:00Z" }, { "Name": "Pistol Whipped", "Description": "Kill 5 enemies with a pistol in a single round.", "Achieved": 0, "UnlockTime": null } ] } ``` ``` -------------------------------- ### Get Player List from Game Server (.NET) Source: https://context7.com/hu3bl/querymaster/llms.txt Fetches a detailed list of all players currently connected to a game server, including their names, scores, and time connected. The result can be iterated through or serialized to JSON. Requires server address and port. ```csharp using QueryMaster; using QueryMaster.GameServer; using (var server = ServerQuery.GetServerInstance( Game.CSGO, "play.example.com", 27015 )) { // Get all players QueryMasterCollection players = server.GetPlayers(); if (players != null) { Console.WriteLine($"Total Players: {players.Count}"); foreach (Player player in players) { Console.WriteLine($"Name: {player.Name}"); Console.WriteLine($"Score: {player.Score}"); Console.WriteLine($"Time Connected: {player.Time} seconds"); Console.WriteLine("---"); } // QueryMasterCollection supports JSON serialization string json = players.ToJson(); Console.WriteLine(json); } } ``` -------------------------------- ### Steam Web API: Get Owned Games (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Fetches a list of games owned by a Steam user, including playtime information, using the QueryMaster library. It can optionally include app information and free-to-play games. The output is sorted by total playtime in descending order. ```csharp using QueryMaster; using QueryMaster.Steam; var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); // Get owned games with detailed info var response = steamApi.IPlayerService.GetOwnedGames( steamId: 76561198000000001, includeAppInfo: true, includeFreeGames: true ); if (response != null && response.ParsedResponse != null) { Console.WriteLine($"Total Games: {response.ParsedResponse.GameCount}"); // Sort by playtime var sortedGames = response.ParsedResponse.Games .OrderByDescending(g => g.PlaytimeForever) .Take(10); Console.WriteLine("\nTop 10 Most Played Games:"); foreach (var game in sortedGames) { double hours = game.PlaytimeForever / 60.0; Console.WriteLine($"{game.Name} (AppID: {game.AppId})"); Console.WriteLine($" Total Time: {hours:F1} hours"); Console.WriteLine($" Last 2 Weeks: {game.Playtime2weeks / 60.0:F1} hours"); Console.WriteLine($" Icon: {game.ImgIconUrl}"); } } ``` -------------------------------- ### Steam Web API - Get Owned Games Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves the list of games owned by a Steam user, including playtime information. Requires a Steam API key. ```APIDOC ## Steam Web API - Get Owned Games ### Description Retrieve the list of games owned by a Steam user with playtime information. Requires a Steam API key. ### Method POST (typically, though the library abstracts this) ### Endpoint `IPlayerService.GetOwnedGames` ### Parameters #### Query Parameters - **steamId** (long) - Required - The 64-bit Steam ID of the player. - **includeAppInfo** (bool) - Optional - Whether to include app information (name, icon URL, etc.). Defaults to false. - **includeFreeGames** (bool) - Optional - Whether to include free games in the list. Defaults to false. ### Request Example ```csharp var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); var response = steamApi.IPlayerService.GetOwnedGames( steamId: 76561198000000001, includeAppInfo: true, includeFreeGames: true ); ``` ### Response #### Success Response (200) - **ParsedResponse** (object) - Contains the parsed owned games data. - **GameCount** (int) - The total number of games owned. - **Games** (array) - A list of owned games. - **AppId** (uint) - The AppID of the game. - **Name** (string) - The name of the game (if `includeAppInfo` is true). - **PlaytimeForever** (uint) - Total playtime in minutes. - **Playtime2weeks** (uint) - Playtime in the last two weeks in minutes. - **ImgIconUrl** (string) - URL for the game's icon (if `includeAppInfo` is true). #### Response Example ```json { "GameCount": 500, "Games": [ { "AppId": 730, "Name": "Counter-Strike: Global Offensive", "PlaytimeForever": 10000, "Playtime2weeks": 120, "ImgIconUrl": "..." }, { "AppId": 440, "Name": "Team Fortress 2", "PlaytimeForever": 5000, "Playtime2weeks": 0, "ImgIconUrl": "..." } ] } ``` ``` -------------------------------- ### Retrieve Steam Player Summaries via Web API (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieve public profile information for Steam users including persona name, avatar, profile state, and last logoff time. This C# example uses the QueryMaster library to call the ISteamUser.GetPlayerSummaries endpoint of the Steam Web API. It requires a valid Steam API key and supports retrieving information for multiple Steam IDs simultaneously. ```csharp using QueryMaster; using QueryMaster.Steam; // Initialize Steam API with your API key var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); // Get player summaries (supports multiple Steam IDs) var response = steamApi.ISteamUser.GetPlayerSummaries( 76561198000000001, 76561198000000002, 76561198000000003 ); if (response != null && response.ParsedResponse != null) { foreach (var player in response.ParsedResponse.Players) { Console.WriteLine($"SteamID: {player.SteamId}"); Console.WriteLine($"Name: {player.PersonaName}"); Console.WriteLine($"Profile URL: {player.ProfileUrl}"); Console.WriteLine($"Avatar: {player.AvatarFull}"); Console.WriteLine($"Status: {player.PersonaState}"); Console.WriteLine($"Visibility: {player.CommunityVisibilityState}"); Console.WriteLine($"Last Logoff: {player.LastLogOff}"); Console.WriteLine($"Country: {player.LocCountryCode}"); Console.WriteLine($"Real Name: {player.RealName ?? "Not set"}"); Console.WriteLine("---"); } } ``` -------------------------------- ### Get Steam News for a Game (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Fetches recent news articles and updates for a specified Steam game. This function does not require a Steam API key. It allows specifying the number of articles and the maximum length of the content to retrieve. Outputs news item titles, authors, dates, URLs, and truncated content to the console. ```csharp using QueryMaster; using QueryMaster.Steam; var steamApi = new SteamQuery(); // No API key needed for news // Get news for CS:GO var response = steamApi.ISteamNews.GetNewsForApp( appId: 730, count: 5, maxLength: 500 ); if (response != null && response.ParsedResponse != null) { Console.WriteLine($"Total News Items: {response.ParsedResponse.Newsitems.Count}"); foreach (var news in response.ParsedResponse.Newsitems) { Console.WriteLine($"\n{news.Title}"); Console.WriteLine($"Author: {news.Author}"); Console.WriteLine($"Date: {news.Date}"); Console.WriteLine($"URL: {news.Url}"); Console.WriteLine($"Feed: {news.Feedlabel}"); Console.WriteLine($"Content: {news.Contents.Substring(0, Math.Min(200, news.Contents.Length))}..."); } } ``` -------------------------------- ### Steam Web API - Get Recently Played Games Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves games a user has played recently, including playtime data for the past two weeks. Requires a Steam API key. ```APIDOC ## Steam Web API - Get Recently Played Games ### Description Retrieve games a user has played recently with playtime data for the past two weeks. Requires a Steam API key. ### Method POST (typically, though the library abstracts this) ### Endpoint `IPlayerService.GetRecentlyPlayedGames` ### Parameters #### Query Parameters - **steamId** (long) - Required - The 64-bit Steam ID of the player. - **count** (int) - Optional - The number of games to return. Defaults to 10. ### Request Example ```csharp var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); var response = steamApi.IPlayerService.GetRecentlyPlayedGames( steamId: 76561198000000001, count: 10 ); ``` ### Response #### Success Response (200) - **ParsedResponse** (object) - Contains the parsed recently played games data. - **TotalCount** (int) - The total number of games played recently. - **Games** (array) - A list of recently played games. - **AppId** (uint) - The AppID of the game. - **Name** (string) - The name of the game. - **Playtime2weeks** (uint) - Playtime in the last two weeks in minutes. - **PlaytimeForever** (uint) - Total playtime in minutes. - **ImgLogoUrl** (string) - URL for the game's logo. #### Response Example ```json { "TotalCount": 5, "Games": [ { "AppId": 730, "Name": "Counter-Strike: Global Offensive", "Playtime2weeks": 120, "PlaytimeForever": 10000, "ImgLogoUrl": "..." }, { "AppId": 570, "Name": "Dota 2", "Playtime2weeks": 60, "PlaytimeForever": 2000, "ImgLogoUrl": "..." } ] } ``` ``` -------------------------------- ### Steam Web API: Get Player Achievements (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves achievement data for a specific game and player from Steam using the QueryMaster library. Requires a Steam API key and provides details about unlocked achievements and overall progress. Does not include achievements for games the player has not yet acquired. ```csharp using QueryMaster; using QueryMaster.Steam; var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); // Get achievements for CS:GO (AppID 730) var response = steamApi.ISteamUserStats.GetPlayerAchievements( steamId: 76561198000000001, appId: 730, language: "en" ); if (response != null && response.ParsedResponse != null) { Console.WriteLine($"Game: {response.ParsedResponse.GameName}"); Console.WriteLine($"Total Achievements: {response.ParsedResponse.Achievements.Count}"); int unlockedCount = 0; foreach (var achievement in response.ParsedResponse.Achievements) { if (achievement.Achieved == 1) { unlockedCount++; Console.WriteLine($"✓ {achievement.Name}: {achievement.Description}"); Console.WriteLine($" Unlocked: {achievement.UnlockTime}"); } } Console.WriteLine($"\nProgress: {unlockedCount}/{response.ParsedResponse.Achievements.Count}"); } ``` -------------------------------- ### Steam Web API: Get Recently Played Games (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves a list of games recently played by a Steam user, including playtime data for the past two weeks and total playtime, using the QueryMaster library. It displays game names, app IDs, and playtime details. ```csharp using QueryMaster; using QueryMaster.Steam; var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); // Get recently played games var response = steamApi.IPlayerService.GetRecentlyPlayedGames( steamId: 76561198000000001, count: 10 ); if (response != null && response.ParsedResponse != null) { Console.WriteLine($"Recently Played Games: {response.ParsedResponse.TotalCount}"); foreach (var game in response.ParsedResponse.Games) { Console.WriteLine($"\n{game.Name} (AppID: {game.AppId})"); Console.WriteLine($" Playtime (2 weeks): {game.Playtime2weeks / 60.0:F1} hours"); Console.WriteLine($" Total Playtime: {game.PlaytimeForever / 60.0:F1} hours"); Console.WriteLine($" Logo: http://media.steampowered.com/steamcommunity/public/images/apps/{game.AppId}/{game.ImgLogoUrl}.jpg"); } } ``` -------------------------------- ### Check Steam Player Bans via Web API (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Check if players have VAC bans, community bans, or game bans on their Steam accounts. This C# example utilizes the QueryMaster library to query the ISteamUser.GetPlayerBans endpoint of the Steam Web API. It requires a Steam API key and can check the ban status for multiple Steam IDs. ```csharp using QueryMaster; using QueryMaster.Steam; var steamApi = new SteamQuery("YOUR_STEAM_API_KEY"); // Check ban status for multiple players var response = steamApi.ISteamUser.GetPlayerBans( 76561198000000001, 76561198000000002 ); if (response != null && response.ParsedResponse != null) { foreach (var player in response.ParsedResponse.Players) { Console.WriteLine($"SteamID: {player.SteamId}"); Console.WriteLine($"Community Banned: {player.CommunityBanned}"); Console.WriteLine($"VAC Banned: {player.VACBanned}"); Console.WriteLine($"Number of VAC Bans: {player.NumberOfVACBans}"); Console.WriteLine($"Days Since Last Ban: {player.DaysSinceLastBan}"); Console.WriteLine($"Number of Game Bans: {player.NumberOfGameBans}"); Console.WriteLine($"Economy Ban: {player.EconomyBan}"); Console.WriteLine("---"); } } ``` -------------------------------- ### Listen to Server Logs and Events with QueryMaster (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt This C# snippet shows how to set up a listener for real-time server events using QueryMaster. It covers subscribing to various events like player kills, chat messages, connections, disconnections, map changes, and server cvars. ```csharp using QueryMaster; using QueryMaster.GameServer; using System; using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015 )) { // Set up log listener on port 27500 Logs logListener = server.GetLogs(27500); // Create event subscription handler LogEvents events = logListener.GetEventsInstance(); // Subscribe to player kill events events.PlayerKilled += (sender, e) => { Console.WriteLine($"{e.Attacker.Name} killed {e.Victim.Name} with {e.Weapon}"); Console.WriteLine($"Attacker Team: {e.Attacker.Team}"); Console.WriteLine($"Was Headshot: {e.IsHeadshot}"); }; // Subscribe to chat messages events.ChatMessage += (sender, e) => { Console.WriteLine($"[{e.Type}] {e.Player.Name}: {e.Message}"); }; // Subscribe to player connections events.PlayerConnected += (sender, e) => { Console.WriteLine($"{e.Player.Name} connected from {e.Player.Address}"); }; // Subscribe to player disconnections events.PlayerDisconnected += (sender, e) => { Console.WriteLine($"{e.Player.Name} disconnected"); }; // Subscribe to map changes events.MapStarted += (sender, e) => { Console.WriteLine($"Map started: {e.MapName}"); }; // Subscribe to server cvars events.ServerCvar += (sender, e) => { Console.WriteLine($"Server cvar: {e.CvarName} = {e.CvarValue}"); }; // Start listening for logs logListener.Start(); Console.WriteLine("Listening for server events... Press Enter to stop."); Console.ReadLine(); // Stop listening logListener.Stop(); } ``` -------------------------------- ### Execute RCON Commands with QueryMaster (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt This C# snippet demonstrates how to send administrative commands to a game server using RCON authentication. It covers executing single commands, changing maps, kicking players, handling multi-packet responses, and managing server logging. ```csharp using QueryMaster; using QueryMaster.GameServer; using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015 )) { // Authenticate with RCON password using (Rcon rcon = server.GetControl("your_rcon_password")) { if (rcon != null) { // Execute single command string response = rcon.SendCommand("status"); Console.WriteLine(response); // Change map response = rcon.SendCommand("changelevel de_dust2"); Console.WriteLine(response); // Kick player response = rcon.SendCommand("kick PlayerName"); Console.WriteLine(response); // Multi-packet response handling for large outputs string bigResponse = rcon.SendCommand("cvarlist", isMultiPacketResponse: true); Console.WriteLine(bigResponse); // Enable server logging rcon.Enablelogging(); // Configure log destination rcon.AddlogAddress("192.168.1.50", 27500); // Disable logging when done rcon.Disablelogging(); } } } ``` -------------------------------- ### Query Game Server Information Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieve basic information about any Source or Gold Source game server including server name, map, player count, and configuration. ```APIDOC ## Query Game Server Information ### Description Retrieve basic information about any Source or Gold Source game server including server name, map, player count, and configuration. ### Method GET (Implicit) ### Endpoint N/A (Library function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp using QueryMaster; using QueryMaster.GameServer; // Create server instance using engine type using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015, sendTimeout: 3000, receiveTimeout: 3000, retries: 3, throwExceptions: true )) { // Get server information ServerInfo info = server.GetInfo(); if (info != null) { Console.WriteLine($"Server: {info.Name}"); Console.WriteLine($"Map: {info.Map}"); Console.WriteLine($"Players: {info.Players}/{info.MaxPlayers}"); Console.WriteLine($"Game: {info.Description}"); Console.WriteLine($"Type: {info.ServerType}"); Console.WriteLine($"Environment: {info.Environment}"); } } ``` ### Response #### Success Response (200) - **ServerInfo** (object) - Contains server details like Name, Map, Players, MaxPlayers, Description, ServerType, and Environment. #### Response Example ```json { "Name": "My Game Server", "Map": "Dust2", "Players": 10, "MaxPlayers": 32, "Description": "Counter-Strike: Global Offensive", "ServerType": "Source", "Environment": "Windows" } ``` ``` -------------------------------- ### Query Server Rules and Configuration Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieve all server console variables (cvars) and rules configured on the server. ```APIDOC ## Query Server Rules and Configuration ### Description Retrieve all server console variables (cvars) and rules configured on the server. ### Method GET (Implicit) ### Endpoint N/A (Library function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp using QueryMaster; using QueryMaster.GameServer; using System.Linq; using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015 )) { // Get server rules (cvars) QueryMasterCollection rules = server.GetRules(); if (rules != null) { Console.WriteLine($"Total Rules: {rules.Count}"); // Display all rules foreach (Rule rule in rules) { Console.WriteLine($"{rule.Name} = {rule.Value}"); } // Find specific rule var maxPlayers = rules.FirstOrDefault(r => r.Name == "sv_maxplayers"); if (maxPlayers != null) { Console.WriteLine($"Max Players Setting: {maxPlayers.Value}"); } } } ``` ### Response #### Success Response (200) - **QueryMasterCollection** (array) - A collection of Rule objects, each containing Name and Value. #### Response Example ```json [ { "Name": "sv_maxplayers", "Value": "32" }, { "Name": "mp_friendlyfire", "Value": "1" } ] ``` ``` -------------------------------- ### Query Server Rules and Configuration (.NET) Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves all configured server console variables (cvars) and rules from a game server. Allows iterating through all rules or searching for specific ones, like 'sv_maxplayers'. Requires server address and port. ```csharp using QueryMaster; using QueryMaster.GameServer; using System.Linq; using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015 )) { // Get server rules (cvars) QueryMasterCollection rules = server.GetRules(); if (rules != null) { Console.WriteLine($"Total Rules: {rules.Count}"); // Display all rules foreach (Rule rule in rules) { Console.WriteLine($"{rule.Name} = {rule.Value}"); } // Find specific rule var maxPlayers = rules.FirstOrDefault(r => r.Name == "sv_maxplayers"); if (maxPlayers != null) { Console.WriteLine($"Max Players Setting: {maxPlayers.Value}"); } } } ``` -------------------------------- ### Convert Steam ID Formats Source: https://context7.com/hu3bl/querymaster/llms.txt Utility to convert between different Steam ID formats, including legacy, Steam3, SteamID64, and community URLs. ```APIDOC ## Convert Steam ID Formats ### Description Utility to convert between different Steam ID formats including legacy, Steam3, SteamID64, and community URLs. ### Method Static class methods ### Endpoint `QueryMaster.Utils.SteamId` ### Parameters Various static methods accept different input formats: - `FromSteamId64(long steamId64)` - `FromLegacyFormat(string legacyId)` - `FromSteamId3(string steamId3)` - `FromCommunityUrl(string customUrl, string apiKey)` - `new SteamId(uint accountId, AccountType accountType, Universe universe, Instance instance)` ### Request Example ```csharp using QueryMaster.Utils; // Create from 64-bit Steam ID SteamId steamId = SteamId.FromSteamId64(76561198000000001); // Create from legacy format (STEAM_X:Y:Z) steamId = SteamId.FromLegacyFormat("STEAM_0:1:12345"); // Create from Steam3 format ([U:1:24691]) steamId = SteamId.FromSteamId3("[U:1:24691]"); // Create from community URL steamId = SteamId.FromCommunityUrl("customurl", "YOUR_API_KEY"); // Create from components steamId = new SteamId( accountId: 12345, accountType: AccountType.Individual, universe: Universe.Public, instance: Instance.Desktop ); ``` ### Response #### Success Response - **SteamId** (object) - A SteamId object representing the converted ID. - **IsValid** (bool) - True if the Steam ID is valid. - **AccountId** (uint) - The account ID portion of the Steam ID. - **AccountType** (AccountType) - The type of account (e.g., Individual, Clan). - **Universe** (Universe) - The Steam universe (e.g., Public, Beta). - **Instance** (Instance) - The instance of the account (e.g., Desktop, Web). Methods for conversion: - `ToLegacyFormat()` - `ToSteamId3(bool includeInstanceId = false)` - `ToSteamId64()` - `ToCommunityUrl()` - `GetVanityUrl()` #### Response Example ```csharp if (steamId.IsValid) { Console.WriteLine($"Account ID: {steamId.AccountId}"); Console.WriteLine($"Legacy: {steamId.ToLegacyFormat()}"); Console.WriteLine($"SteamID64: {steamId.ToSteamId64()}"); Console.WriteLine($"Community URL: {steamId.ToCommunityUrl()}"); } ``` ``` -------------------------------- ### Steam ID Format Conversion Utility (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt Utilizes the QueryMaster.Utils.SteamId class in C# to convert between various Steam ID formats, including legacy, Steam3, SteamID64, and community URLs. It allows creating SteamId objects from different inputs and converting them to multiple output formats. ```csharp using QueryMaster.Utils; using System; // Create from 64-bit Steam ID SteamId steamId = SteamId.FromSteamId64(76561198000000001); // Create from legacy format (STEAM_X:Y:Z) steamId = SteamId.FromLegacyFormat("STEAM_0:1:12345"); // Create from Steam3 format ([U:1:24691]) steamId = SteamId.FromSteamId3("[U:1:24691]"); // Create from community URL steamId = SteamId.FromCommunityUrl("customurl", "YOUR_API_KEY"); // Create from components steamId = new SteamId( accountId: 12345, accountType: AccountType.Individual, universe: Universe.Public, instance: Instance.Desktop ); // Check validity if (steamId.IsValid) { Console.WriteLine($"Account ID: {steamId.AccountId}"); Console.WriteLine($"Account Type: {steamId.AccountType}"); Console.WriteLine($"Universe: {steamId.Universe}"); Console.WriteLine($"Instance: {steamId.Instance}"); // Convert to different formats Console.WriteLine($"Legacy: {steamId.ToLegacyFormat()}"); Console.WriteLine($"Steam3: {steamId.ToSteamId3()}"); Console.WriteLine($"Steam3 (with instance): {steamId.ToSteamId3(includeInstanceId: true)}"); Console.WriteLine($"SteamID64: {steamId.ToSteamId64()}"); Console.WriteLine($"Community URL: {steamId.ToCommunityUrl()}"); Console.WriteLine($"Vanity URL: {steamId.GetVanityUrl()}"); } else { Console.WriteLine("Invalid Steam ID"); } ``` -------------------------------- ### Filter Server Log Events with QueryMaster (C#) Source: https://context7.com/hu3bl/querymaster/llms.txt This C# snippet demonstrates how to filter server log events using QueryMaster. It shows how to add filters based on player names, string patterns, and regular expressions, and then subscribe to the filtered events. ```csharp using QueryMaster; using QueryMaster.GameServer; using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015 )) { Logs logListener = server.GetLogs(27500); LogEvents events = logListener.GetEventsInstance(); // Create filter collection LogFilterCollection filters = logListener.GetFilterCollection(); // Filter by player name filters.Add(new PlayerFilter { Name = "TargetPlayerName", Mode = PlayerFilterMode.Include }); // Filter by string pattern filters.Add(new StringFilter { Pattern = "killed", Mode = StringFilterMode.Contains }); // Filter by regex pattern filters.Add(new RegexFilter { Pattern = @"^\d{2}/\d{2}/\d{4}", Mode = RegexFilterMode.Match }); // Apply filters logListener.SetFilters(filters); // Subscribe to filtered events events.PlayerKilled += (sender, e) => { Console.WriteLine($"Filtered kill: {e.Attacker.Name} -> {e.Victim.Name}"); }; logListener.Start(); Console.WriteLine("Listening with filters..."); Console.ReadLine(); logListener.Stop(); } ``` -------------------------------- ### Query Game Server Information (.NET) Source: https://context7.com/hu3bl/querymaster/llms.txt Retrieves basic information about a Source or Gold Source game server, such as its name, map, player count, and game type. This function requires specifying the engine type, IP address, and port of the server. ```csharp using QueryMaster; using QueryMaster.GameServer; // Create server instance using engine type using (var server = ServerQuery.GetServerInstance( EngineType.Source, "192.168.1.100", 27015, sendTimeout: 3000, receiveTimeout: 3000, retries: 3, throwExceptions: true )) { // Get server information ServerInfo info = server.GetInfo(); if (info != null) { Console.WriteLine($"Server: {info.Name}"); Console.WriteLine($"Map: {info.Map}"); Console.WriteLine($"Players: {info.Players}/{info.MaxPlayers}"); Console.WriteLine($"Game: {info.Description}"); Console.WriteLine($"Type: {info.ServerType}"); Console.WriteLine($"Environment: {info.Environment}"); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.