Cleaned up code smells.

Made fields readonly when possible.

Changed message for exception regarding argument to be correct.
This commit is contained in:
Harrison Deng 2020-12-25 03:47:13 -06:00
parent acd735d9df
commit 3a49502970
3 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ namespace GameServiceWarden.Host.Modules
{
class ModuleLoadContext : AssemblyLoadContext
{
private AssemblyDependencyResolver dependencyResolver;
private readonly AssemblyDependencyResolver dependencyResolver;
public ModuleLoadContext(string path) {
dependencyResolver = new AssemblyDependencyResolver(path);

View File

@ -6,7 +6,7 @@ namespace GameServiceWarden.Host.Modules
{
public class ServiceGateway
{
private string dataDirectory;
private readonly string dataDirectory;
private const string SERVICE_NAME = "Service Name";
private const string ASSEMBLY_NAME = "Assembly Name";
private const string MODULE_NAME = "Module Name";

View File

@ -22,7 +22,7 @@ namespace GameServiceWarden.Host.Modules
/// </summary>
private volatile string serviceName; //thread-safe(?)
public Stream ServiceConsoleStream { get; private set; } // Thread safe.
private object controlLock = new object();
private readonly object controlLock = new object();
private volatile ServiceState state;
private readonly IGameService service;
private readonly string assemblyName;
@ -32,7 +32,7 @@ namespace GameServiceWarden.Host.Modules
public ServiceInfo(IGameService service, string moduleName, string assemblyName)
{
this.service = service ?? throw new ArgumentNullException("serviceable");
this.service = service ?? throw new ArgumentNullException("service");
this.moduleName = moduleName ?? throw new ArgumentNullException("moduleName");
this.assemblyName = assemblyName ?? throw new ArgumentNullException("assemblyName");
this.service.StateChangeEvent += OnServiceStateChange;