-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
4,552 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text.Json; | ||
using MySqlConnector; | ||
using Dapper; | ||
|
||
namespace LevelsRanks.API | ||
{ | ||
public interface IPointsManager | ||
{ | ||
int AddOrRemovePoints(string steamId, int points, CCSPlayerController playerController, string reason, string messageColor); | ||
List<RankConfig> LoadRanksConfig(); | ||
RankConfig? GetCurrentRank(string steamID64); | ||
string GetConnectionString(); | ||
DatabaseConfig GetDatabaseConfig(); | ||
} | ||
public class RankConfig | ||
{ | ||
public int Id { get; set; } | ||
public string? Name { get; set; } | ||
public int MinExperience { get; set; } | ||
} | ||
public class DatabaseConfig | ||
{ | ||
public string DbHost { get; set; } | ||
public string DbUser { get; set; } | ||
public string DbPassword { get; set; } | ||
public string DbName { get; set; } | ||
public string DbPort { get; set; } | ||
public string Name { get; set; } | ||
|
||
public static DatabaseConfig ReadFromJsonFile(string filePath) | ||
{ | ||
string jsonConfig = File.ReadAllText(filePath); | ||
return JsonSerializer.Deserialize<DatabaseConfig>(jsonConfig) ?? new DatabaseConfig(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Platforms>AnyCPU;x86</Platforms> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="CounterStrikeSharp.API"> | ||
<HintPath>..\CounterStrikeSharp.API.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Dapper" Version="2.1.24" /> | ||
<PackageReference Include="MySqlConnector" Version="2.3.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Platforms>AnyCPU;x86</Platforms> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="CounterStrikeSharp.API"> | ||
<HintPath>..\CounterStrikeSharp.API.dll</HintPath> | ||
</Reference> | ||
<Reference Include="LevelsRanks.API.dll"> | ||
<HintPath>..\LevelsRanks.API.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Dapper" Version="2.1.24" /> | ||
<PackageReference Include="MySqlConnector" Version="2.3.1" /> | ||
<PackageReference Include="YamlDotNet" Version="9.1.4" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||
</ItemGroup> | ||
</Project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text.Json; | ||
using MySqlConnector; | ||
using Dapper; | ||
|
||
namespace LevelsRanks.API | ||
{ | ||
public interface IPointsManager | ||
{ | ||
int AddOrRemovePoints(string steamId, int points, CCSPlayerController playerController, string reason, string messageColor); | ||
List<RankConfig> LoadRanksConfig(); | ||
RankConfig? GetCurrentRank(string steamID64); | ||
string GetConnectionString(); | ||
DatabaseConfig GetDatabaseConfig(); | ||
} | ||
public class RankConfig | ||
{ | ||
public int Id { get; set; } | ||
public string? Name { get; set; } | ||
public int MinExperience { get; set; } | ||
} | ||
public class DatabaseConfig | ||
{ | ||
public string DbHost { get; set; } | ||
public string DbUser { get; set; } | ||
public string DbPassword { get; set; } | ||
public string DbName { get; set; } | ||
public string DbPort { get; set; } | ||
public string Name { get; set; } | ||
|
||
public static DatabaseConfig ReadFromJsonFile(string filePath) | ||
{ | ||
string jsonConfig = File.ReadAllText(filePath); | ||
return JsonSerializer.Deserialize<DatabaseConfig>(jsonConfig) ?? new DatabaseConfig(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Platforms>AnyCPU;x86</Platforms> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="CounterStrikeSharp.API"> | ||
<HintPath>..\CounterStrikeSharp.API.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Dapper" Version="2.1.24" /> | ||
<PackageReference Include="MySqlConnector" Version="2.3.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.