Skip to content

Commit

Permalink
Load all dlls when no includeDlls are configured
Browse files Browse the repository at this point in the history
  • Loading branch information
proepkes committed Nov 2, 2018
1 parent caa18a2 commit c712ab0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion SpeedDate/Configuration/FileConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public FileConfigProvider(string configFile)
});
}


public void Configure(IEnumerable<IConfig> configInstances)
{
var configuration = File.ReadAllText(_configFile);
Expand Down
22 changes: 14 additions & 8 deletions SpeedDate/SpeedDateKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,21 @@ private TinyIoCContainer CreateContainer(ISpeedDateStartable startable)
ioc.Register((container, overloads, requesttype) => (IClient) startable);
break;
}

//Register configs & plugins
foreach (var dllFile in
Directory.GetFiles(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ??
throw new InvalidOperationException(), "*.dll").Where(

var allFiles = Directory.GetFiles(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ??
throw new InvalidOperationException(), "*.dll");

if (_config.Plugins.IncludeDlls.Length > 0)
{
allFiles = allFiles.Where(
file => _config.Plugins.IncludeDlls.Split(';').Any(includeDll =>
Regex.IsMatch(Path.GetFileNameWithoutExtension(file), includeDll.Trim().AsRegular()))
))
Regex.IsMatch(Path.GetFileNameWithoutExtension(file), includeDll.Trim().AsRegular())))
.ToArray();
}

//Register configs & plugins
foreach (var dllFile in allFiles)
{
_logger.Info($"Loading dll: {dllFile}");

Expand Down

0 comments on commit c712ab0

Please sign in to comment.