SampAccess 1.0.3
dotnet add package SampAccess --version 1.0.3
NuGet\Install-Package SampAccess -Version 1.0.3
<PackageReference Include="SampAccess" Version="1.0.3" />
<PackageVersion Include="SampAccess" Version="1.0.3" />
<PackageReference Include="SampAccess" />
paket add SampAccess --version 1.0.3
#r "nuget: SampAccess, 1.0.3"
#:package SampAccess@1.0.3
#addin nuget:?package=SampAccess&version=1.0.3
#tool nuget:?package=SampAccess&version=1.0.3
SampAccess Library
This .NET library may simplify your access to SA:MP servers (gathering information about them) and to SA:MP client settings
Warning
This library was written long ago, and it won't be maintained anymore.
Requirements
- .NET 6 - https://dotnet.microsoft.com/
Notes
I wrote this library as an analogue under the MIT license, since those that I found in the Internet were either proprietary or under the GPL license, which is not always suitable.
Client class IS NOT CROSS-PLATFORM. It requires Microsoft.Win32.Registry package, which is working only in Windows.
The Query algorithm is based on https://github.com/zeelorenc/SA-MP-Server-Query-Class, but code is rewritten
Query example
SampAccess API is pretty easy and straightforward. Here is an example:
using System;
using SampAccess;
namespace Test
{
class Program
{
public static void Main(string[] args)
{
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
using Query query = new(/* IP */ args[1], /* Port */ Convert.ToUInt16(args[2]));
query.Initialize();
// Basic information about a server
Console.WriteLine($"Ping {query.PingInMilliseconds} ms\n");
Console.WriteLine("Common information:\n" +
$"Players: {query.CommonInformation.PlayersOnline}/{query.CommonInformation.LimitOfPlayers}\n" +
$"Has password: {query.CommonInformation.HasPassword}\n" +
$"Host name: {query.CommonInformation.HostName}\n" +
$"Game mode: {query.CommonInformation.GameMode}\n" +
$"Language: {query.CommonInformation.Language}\n");
// Server rules
Console.WriteLine("Server rules:");
foreach(KeyValuePair<string, string> rule in query.ServerRules)
{
Console.WriteLine($"Key: {rule.Key}; Value: {rule.Value}");
}
Console.WriteLine();
// Player information
Console.WriteLine("Players:");
foreach (Query.Player player in query.PlayersInformation)
{
Console.WriteLine($"Player nick: {player.Nick}\n" +
$"Ping: {player.Ping}\n" +
$"Score: {player.Score}");
if(player.PlayerID != null)
{
Console.WriteLine($"Player ID: {player.PlayerID}");
}
Console.WriteLine();
}
}
}
}
Client example
Client is even more simple, than Query class:
using System;
using SampAccess;
namespace Test
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine($"Your nickname: {Client.PlayerName}");
Console.WriteLine($"Game executable path: {Client.GameExecutable}");
Console.WriteLine("Checkboxes:\n" +
$"Save RCON passwords: {Client.SaveRconPasswords}\n" +
$"Save server passwords: {Client.SaveServerPasswords}");
Console.WriteLine();
Console.Write("Your new nickname: ");
Client.PlayerName = Console.ReadLine();
Console.Write("Your new game executable: ");
Client.GameExecutable = Console.ReadLine();
Console.Write("Do you want to save RCON passwords: ");
Client.SaveRconPasswords = Convert.ToInt32(Console.ReadLine());
Console.Write("Do you want to save server passwords: ");
Client.SaveServerPasswords = Convert.ToInt32(Console.ReadLine());
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Text.Encoding.CodePages (>= 6.0.0)
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.0.3 | 190 | 8/20/2024 |
| 1.0.2 | 194 | 8/18/2024 |
| 1.0.1-stable | 443 | 6/22/2021 |