Cleaned up code.
Changed variable names that hide fields. Removed unused imports.
This commit is contained in:
parent
522b34810e
commit
ba970dac4c
@ -40,12 +40,12 @@ namespace GameServiceWarden.Core.Games
|
|||||||
this.assemblyName = assemblyName ?? throw new ArgumentNullException("assemblyName");
|
this.assemblyName = assemblyName ?? throw new ArgumentNullException("assemblyName");
|
||||||
this.service.StateChangeEvent += OnServiceStateChange;
|
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)
|
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>
|
/// <summary>
|
||||||
|
@ -22,10 +22,10 @@ namespace GameServiceWarden.Core.Games
|
|||||||
public void CreateService(string serviceName, string assemblyName, string moduleName)
|
public void CreateService(string serviceName, string assemblyName, string moduleName)
|
||||||
{
|
{
|
||||||
if (!this.modules.ContainsKey(assemblyName)) throw new KeyNotFoundException($"No file \"{assemblyName}\" found.");
|
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.");
|
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)
|
public void DeleteService(string serviceName)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace GameServiceWarden.ModuleAPI
|
namespace GameServiceWarden.ModuleAPI
|
||||||
{
|
{
|
||||||
public enum ServiceState
|
public enum ServiceState
|
||||||
|
Reference in New Issue
Block a user