Skip to content

Commit 7497297

Browse files
authored
Add files via upload
Init
1 parent b2a00e0 commit 7497297

27 files changed

+15815
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.266" />
11+
<PackageReference Include="Npgsql" Version="8.0.4" />
12+
</ItemGroup>
13+
14+
</Project>

ClassicExtender/Config.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using CounterStrikeSharp.API.Core;
2+
using System.Text.Json.Serialization;
3+
4+
namespace ClassicExtender
5+
{
6+
public class ClassicExtenderConfig : BasePluginConfig
7+
{
8+
public override int Version { get; set; } = 1;
9+
10+
[JsonPropertyName("DatabaseHost")]
11+
public string DatabaseHost { get; set; } = "localhost";
12+
13+
[JsonPropertyName("DatabasePort")]
14+
public int DatabasePort { get; set; } = 5432;
15+
16+
[JsonPropertyName("DatabaseUser")]
17+
public string DatabaseUser { get; set; } = "postgres";
18+
19+
[JsonPropertyName("DatabasePassword")]
20+
public string DatabasePassword { get; set; } = "password";
21+
22+
[JsonPropertyName("DatabaseName")]
23+
public string DatabaseName { get; set; } = "database";
24+
25+
[JsonPropertyName("KillPoints")]
26+
public int KillPoints { get; set; } = 2;
27+
28+
[JsonPropertyName("HSPoints")]
29+
public int HSPoints { get; set; } = 3;
30+
31+
[JsonPropertyName("NSPoints")]
32+
public int NSPoints { get; set; } = 4;
33+
34+
[JsonPropertyName("AssistPoints")]
35+
public int AssistPoints { get; set; } = 1;
36+
37+
[JsonPropertyName("DeathPoints")]
38+
public int DeathPoints { get; set; } = 1;
39+
40+
[JsonPropertyName("HEPoints")]
41+
public int HEPoints { get; set; } = 1;
42+
43+
[JsonPropertyName("INCPoints")]
44+
public int MOPoints { get; set; } = 1;
45+
46+
}
47+
}

ClassicExtender/DatabaseManager.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Npgsql;
2+
using System.Data;
3+
4+
namespace DatabaseManager
5+
{
6+
public class DatabaseConnectionManager
7+
{
8+
private readonly string _connectionString;
9+
private NpgsqlConnection? _connection;
10+
11+
public DatabaseConnectionManager(string connectionString)
12+
{
13+
_connectionString = connectionString;
14+
}
15+
16+
public async Task<NpgsqlConnection> GetConnectionAsync()
17+
{
18+
if (_connection == null || _connection.State != ConnectionState.Open)
19+
{
20+
_connection = new NpgsqlConnection(_connectionString);
21+
await _connection.OpenAsync();
22+
}
23+
24+
return _connection;
25+
}
26+
27+
public async Task CloseConnectionAsync()
28+
{
29+
if (_connection != null && _connection.State == ConnectionState.Open)
30+
{
31+
await _connection.CloseAsync();
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)