Cleaned up code.

Changed variable names that hide fields.
Removed unused imports.
This commit is contained in:
Harrison Deng 2021-03-30 21:55:19 -05:00
parent 522b34810e
commit ba970dac4c
3 changed files with 5 additions and 7 deletions

View File

@ -40,12 +40,12 @@ namespace GameServiceWarden.Core.Games
this.assemblyName = assemblyName ?? throw new ArgumentNullException("assemblyName");
this.service.StateChangeEvent += OnServiceStateChange;
Dictionary<string, IGameConfigurable> configurables = new Dictionary<string, IGameConfigurable>();
Dictionary<string, IGameConfigurable> tempConfigurables = new Dictionary<string, IGameConfigurable>();
foreach (IGameConfigurable configurable in service.Configurables)
{
configurables.Add(configurable.OptionName, configurable);
tempConfigurables.Add(configurable.OptionName, configurable);
}
this.configurables = new ReadOnlyDictionary<string, IGameConfigurable>(configurables);
this.configurables = new ReadOnlyDictionary<string, IGameConfigurable>(tempConfigurables);
}
/// <summary>

View File

@ -22,10 +22,10 @@ namespace GameServiceWarden.Core.Games
public void CreateService(string serviceName, string assemblyName, string moduleName)
{
if (!this.modules.ContainsKey(assemblyName)) throw new KeyNotFoundException($"No file \"{assemblyName}\" found.");
IReadOnlyDictionary<string, IGameServiceModule> modules = this.modules[assemblyName];
IReadOnlyDictionary<string, IGameServiceModule> assemblyModules = this.modules[assemblyName];
if (services.ContainsKey(serviceName)) throw new ArgumentException($"Service of Name \"{serviceName}\" already exists.");
services.Add(serviceName, new GameServiceInfo(modules[moduleName].InstantiateGameService(services.GetPathForKey(serviceName), true), moduleName, assemblyName));
services.Add(serviceName, new GameServiceInfo(assemblyModules[moduleName].InstantiateGameService(services.GetPathForKey(serviceName), true), moduleName, assemblyName));
}
public void DeleteService(string serviceName)

View File

@ -1,5 +1,3 @@
using System;
namespace GameServiceWarden.ModuleAPI
{
public enum ServiceState