From 2f1c4ed4a18fa816560960ea25edbf194cc42acb Mon Sep 17 00:00:00 2001 From: Dave Roman <43916038+MrDave1999@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:37:24 -0500 Subject: [PATCH] refactor: Convert types to public from the application layer (#28) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no benefit in keeping the types as “internal”. This modifier is usually most beneficial when working on open source libraries, in which case you do not want to expose internal library details. This change also avoids this error: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0053 --- src/Application/Players/Accounts/AccountComponent.cs | 2 +- src/Application/Players/Accounts/AccountStatus.cs | 2 +- src/Application/Players/Accounts/RoleCollection.cs | 2 +- src/Application/Players/Ranks/IRank.cs | 2 +- src/Application/Players/Ranks/RankCollection.cs | 2 +- src/Application/Players/Ranks/RankSystem.cs | 2 +- src/Application/Players/Weapons/GtaWeapons.cs | 2 +- src/Application/Players/Weapons/IWeapon.cs | 2 +- src/Application/Players/Weapons/WeaponPack.cs | 2 +- src/Application/Players/Weapons/WeaponSelectionComponent.cs | 2 +- src/Application/Players/Weapons/WeaponSystem.cs | 2 +- src/Application/Teams/ClassSelectionComponent.cs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Application/Players/Accounts/AccountComponent.cs b/src/Application/Players/Accounts/AccountComponent.cs index 43737f8a..c56260eb 100644 --- a/src/Application/Players/Accounts/AccountComponent.cs +++ b/src/Application/Players/Accounts/AccountComponent.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Accounts; -internal class AccountComponent : Component +public class AccountComponent : Component { public PlayerInfo PlayerInfo { get; } public AccountStatus Status { get; } diff --git a/src/Application/Players/Accounts/AccountStatus.cs b/src/Application/Players/Accounts/AccountStatus.cs index 6a41543d..60c34c8f 100644 --- a/src/Application/Players/Accounts/AccountStatus.cs +++ b/src/Application/Players/Accounts/AccountStatus.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Accounts; -internal enum AccountStatus +public enum AccountStatus { LoggedIn, Registered diff --git a/src/Application/Players/Accounts/RoleCollection.cs b/src/Application/Players/Accounts/RoleCollection.cs index 28525eb8..9ff593fb 100644 --- a/src/Application/Players/Accounts/RoleCollection.cs +++ b/src/Application/Players/Accounts/RoleCollection.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Accounts; -internal class RoleCollection +public class RoleCollection { private RoleCollection() { } private static readonly RoleId[] s_roles = Enum.GetValues(); diff --git a/src/Application/Players/Ranks/IRank.cs b/src/Application/Players/Ranks/IRank.cs index 327110fe..b711fe1d 100644 --- a/src/Application/Players/Ranks/IRank.cs +++ b/src/Application/Players/Ranks/IRank.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Ranks; -internal interface IRank +public interface IRank { RankId Id { get; } string Name { get; } diff --git a/src/Application/Players/Ranks/RankCollection.cs b/src/Application/Players/Ranks/RankCollection.cs index e18dc97c..593482fe 100644 --- a/src/Application/Players/Ranks/RankCollection.cs +++ b/src/Application/Players/Ranks/RankCollection.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Ranks; -internal class RankCollection +public class RankCollection { private static readonly Rank[] s_ranks = [ diff --git a/src/Application/Players/Ranks/RankSystem.cs b/src/Application/Players/Ranks/RankSystem.cs index 1aec2b99..84f57d4a 100644 --- a/src/Application/Players/Ranks/RankSystem.cs +++ b/src/Application/Players/Ranks/RankSystem.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Ranks; -internal class RankSystem : ISystem +public class RankSystem : ISystem { [PlayerCommand("ranks")] public void ShowRanks(Player player, IDialogService dialogService) diff --git a/src/Application/Players/Weapons/GtaWeapons.cs b/src/Application/Players/Weapons/GtaWeapons.cs index b7a967ae..3c65994f 100644 --- a/src/Application/Players/Weapons/GtaWeapons.cs +++ b/src/Application/Players/Weapons/GtaWeapons.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Weapons; -internal class GtaWeapons +public class GtaWeapons { private static readonly GtaWeapon[] s_weapons = [ diff --git a/src/Application/Players/Weapons/IWeapon.cs b/src/Application/Players/Weapons/IWeapon.cs index be16ee26..1bb95856 100644 --- a/src/Application/Players/Weapons/IWeapon.cs +++ b/src/Application/Players/Weapons/IWeapon.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Weapons; -internal interface IWeapon +public interface IWeapon { const int UnlimitedAmmo = 99999999; Weapon Id { get; } diff --git a/src/Application/Players/Weapons/WeaponPack.cs b/src/Application/Players/Weapons/WeaponPack.cs index 6ede21f3..29600194 100644 --- a/src/Application/Players/Weapons/WeaponPack.cs +++ b/src/Application/Players/Weapons/WeaponPack.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Weapons; -internal class WeaponPack : IEnumerable +public class WeaponPack : IEnumerable { private readonly List _weapons = [ diff --git a/src/Application/Players/Weapons/WeaponSelectionComponent.cs b/src/Application/Players/Weapons/WeaponSelectionComponent.cs index d8548c2e..196c4a08 100644 --- a/src/Application/Players/Weapons/WeaponSelectionComponent.cs +++ b/src/Application/Players/Weapons/WeaponSelectionComponent.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Weapons; -internal class WeaponSelectionComponent : Component +public class WeaponSelectionComponent : Component { public WeaponPack SelectedWeapons { get; } = new(); } diff --git a/src/Application/Players/Weapons/WeaponSystem.cs b/src/Application/Players/Weapons/WeaponSystem.cs index e12bce7a..fc76925b 100644 --- a/src/Application/Players/Weapons/WeaponSystem.cs +++ b/src/Application/Players/Weapons/WeaponSystem.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Players.Weapons; -internal class WeaponSystem : ISystem +public class WeaponSystem : ISystem { [Event] public void OnPlayerConnect(Player player) diff --git a/src/Application/Teams/ClassSelectionComponent.cs b/src/Application/Teams/ClassSelectionComponent.cs index f68e7592..17d1ff66 100644 --- a/src/Application/Teams/ClassSelectionComponent.cs +++ b/src/Application/Teams/ClassSelectionComponent.cs @@ -1,6 +1,6 @@ namespace CTF.Application.Teams; -internal class ClassSelectionComponent : Component +public class ClassSelectionComponent : Component { public bool IsInClassSelection { get; set; } = true; }