diff --git a/OpenCS2hock/CS2MessageHandler.cs b/OpenCS2hock/CS2MessageHandler.cs index ab9e96b..5aef352 100644 --- a/OpenCS2hock/CS2MessageHandler.cs +++ b/OpenCS2hock/CS2MessageHandler.cs @@ -2,17 +2,17 @@ namespace OpenCS2hock; -public class CS2MessageHandler +internal class CS2MessageHandler { - public delegate void CS2EventHandler(); - public event CS2EventHandler? OnKill; - public event CS2EventHandler? OnDeath; - public event CS2EventHandler? OnRoundStart; - public event CS2EventHandler? OnRoundEnd; - public event CS2EventHandler? OnRoundWin; - public event CS2EventHandler? OnRoundLoss; + internal delegate void CS2EventHandler(); + internal event CS2EventHandler? OnKill; + internal event CS2EventHandler? OnDeath; + internal event CS2EventHandler? OnRoundStart; + internal event CS2EventHandler? OnRoundEnd; + internal event CS2EventHandler? OnRoundWin; + internal event CS2EventHandler? OnRoundLoss; - public void HandleCS2Message(string message, string mySteamId) + internal void HandleCS2Message(string message, string mySteamId) { JObject messageJson = JObject.Parse(message); string? steamId = messageJson.SelectToken("player.steamid", false)?.Value(); diff --git a/OpenCS2hock/ConfiguredInteger.cs b/OpenCS2hock/ConfiguredInteger.cs index a57567e..53bc2d8 100644 --- a/OpenCS2hock/ConfiguredInteger.cs +++ b/OpenCS2hock/ConfiguredInteger.cs @@ -1,16 +1,16 @@ namespace OpenCS2hock; -public class ConfiguredInteger +internal class ConfiguredInteger { private readonly int _min, _max; - public ConfiguredInteger(int min = 0, int max = 50) + internal ConfiguredInteger(int min = 0, int max = 50) { this._min = min; this._max = max; } - public int GetValue() + internal int GetValue() { return Random.Shared.Next(_min, _max); } diff --git a/OpenCS2hock/GSIServer.cs b/OpenCS2hock/GSIServer.cs index c213ddb..11f30d1 100644 --- a/OpenCS2hock/GSIServer.cs +++ b/OpenCS2hock/GSIServer.cs @@ -3,16 +3,16 @@ using System.Text; namespace OpenCS2hock; -public class GSIServer +internal class GSIServer { private HttpListener HttpListener { get; init; } - public delegate void OnMessageEventHandler(string content); - public event OnMessageEventHandler? OnMessage; + internal delegate void OnMessageEventHandler(string content); + internal event OnMessageEventHandler? OnMessage; private bool _keepRunning = true; - public bool IsRunning { get; private set; } + internal bool IsRunning { get; private set; } - public GSIServer(int port) + internal GSIServer(int port) { HttpListener = new HttpListener(); HttpListener.Prefixes.Add($"http://127.0.0.1:{port}/"); diff --git a/OpenCS2hock/Installer.cs b/OpenCS2hock/Installer.cs index 9a728c5..0757ffa 100644 --- a/OpenCS2hock/Installer.cs +++ b/OpenCS2hock/Installer.cs @@ -5,7 +5,7 @@ namespace OpenCS2hock; public static class Installer { - public static Settings GetSettings(string? path = null) + internal static Settings GetSettings(string? path = null) { string settingsFilePath = path ?? "config.json"; if (!File.Exists(settingsFilePath)) @@ -14,7 +14,7 @@ public static class Installer return JsonConvert.DeserializeObject(File.ReadAllText(settingsFilePath)); } - public static List GetShockers(Settings settings) + internal static List GetShockers(Settings settings) { List shockers = new(); shockers.Add(new OpenShock(settings.OpenShockSettings.Endpoint, settings.OpenShockSettings.ApiKey, @@ -24,13 +24,13 @@ public static class Installer return shockers; } - public static void InstallGsi() + internal static void InstallGsi() { string installLocation = Path.Combine(GetInstallDirectory(), "game\\csgo\\cfg\\gamestate_integration_opencs2hock.cfg"); File.WriteAllText(installLocation, Resources.GSI_CFG_Content); } - - public static string GetInstallDirectory(int appId = 730) + + private static string GetInstallDirectory(int appId = 730) { string steamInstallation = #pragma warning disable CA1416 //Registry only available on Windows diff --git a/OpenCS2hock/OpenShock.cs b/OpenCS2hock/OpenShock.cs index 20ee586..dd2dee2 100644 --- a/OpenCS2hock/OpenShock.cs +++ b/OpenCS2hock/OpenShock.cs @@ -3,7 +3,7 @@ using System.Text; namespace OpenCS2hock; -public class OpenShock : Shocker +internal class OpenShock : Shocker { protected override void ControlInternal(ControlAction action, string shockerId, int intensity, int duration) { @@ -23,7 +23,7 @@ public class OpenShock : Shocker }; request.Headers.Add("OpenShockToken", ApiKey); HttpResponseMessage response = this.HttpClient.Send(request); - Console.WriteLine(response.StatusCode); + Console.WriteLine($"{request.RequestUri} response: {response.StatusCode}"); } private byte ControlActionToByte(ControlAction action) @@ -37,7 +37,7 @@ public class OpenShock : Shocker }; } - public OpenShock(string endpoint, string apiKey, string[] shockerIds, ConfiguredInteger intensity, ConfiguredInteger duration) : base(endpoint, apiKey, shockerIds, intensity, duration) + internal OpenShock(string endpoint, string apiKey, string[] shockerIds, ConfiguredInteger intensity, ConfiguredInteger duration) : base(endpoint, apiKey, shockerIds, intensity, duration) { } diff --git a/OpenCS2hock/Settings.cs b/OpenCS2hock/Settings.cs index b66d584..2d63653 100644 --- a/OpenCS2hock/Settings.cs +++ b/OpenCS2hock/Settings.cs @@ -44,7 +44,7 @@ public struct Settings return JsonConvert.SerializeObject(this, Formatting.Indented); } - public static Shocker.ControlAction StringToAction(string str) + internal static Shocker.ControlAction StringToAction(string str) { return str.ToLower() switch { diff --git a/OpenCS2hock/Shocker.cs b/OpenCS2hock/Shocker.cs index a9ade06..ef09f15 100644 --- a/OpenCS2hock/Shocker.cs +++ b/OpenCS2hock/Shocker.cs @@ -1,15 +1,15 @@ namespace OpenCS2hock; -public abstract class Shocker +internal abstract class Shocker { protected readonly HttpClient HttpClient; protected readonly string ApiKey,Endpoint; private readonly string[] _shockerIds; private readonly ConfiguredInteger _intensity, _duration; - public enum ControlAction { Beep, Vibrate, Shock, Nothing } + internal enum ControlAction { Beep, Vibrate, Shock, Nothing } - public void Control(ControlAction action, string? shockerId = null) + internal void Control(ControlAction action, string? shockerId = null) { int intensity = _intensity.GetValue(); int duration = _duration.GetValue();