From af4bf2febafe9690db05e2339b08942d1a667b4c Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sun, 29 May 2016 08:41:29 -0500 Subject: [PATCH] (GH-198) pass configuration in messaging --- .../infrastructure.app/events/PostRunMessage.cs | 11 ++++++++++- .../infrastructure.app/events/PreRunMessage.cs | 11 ++++++++++- .../infrastructure.app/runners/GenericRunner.cs | 4 ++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/chocolatey/infrastructure.app/events/PostRunMessage.cs b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs index 510e5be493..1a818afb7b 100644 --- a/src/chocolatey/infrastructure.app/events/PostRunMessage.cs +++ b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs @@ -15,21 +15,30 @@ namespace chocolatey.infrastructure.app.events { + using configuration; using infrastructure.commands; using infrastructure.events; public class PostRunMessage : IMessage { + public ChocolateyConfiguration Configuration { get; private set; } + + public PostRunMessage(ChocolateyConfiguration configuration) + { + this.Configuration = configuration; + } } public class PostRunMessage : IMessage where TCommand : ICommand { public TCommand Command { get; private set; } + public ChocolateyConfiguration Configuration { get; set; } public object[] State { get; private set; } - public PostRunMessage(TCommand command, object[] state) + public PostRunMessage(TCommand command, ChocolateyConfiguration configuration, object[] state) { Command = command; + this.Configuration = configuration; State = state; } } diff --git a/src/chocolatey/infrastructure.app/events/PreRunMessage.cs b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs index 79cb28fa8f..89b9528eed 100644 --- a/src/chocolatey/infrastructure.app/events/PreRunMessage.cs +++ b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs @@ -15,21 +15,30 @@ namespace chocolatey.infrastructure.app.events { + using configuration; using infrastructure.commands; using infrastructure.events; public class PreRunMessage : IMessage { + public ChocolateyConfiguration Configuration { get; private set; } + + public PreRunMessage(ChocolateyConfiguration configuration) + { + this.Configuration = configuration; + } } public class PreRunMessage : IMessage where TCommand : ICommand { public TCommand Command { get; private set; } + public ChocolateyConfiguration Configuration { get; private set; } public object[] State { get; private set; } - public PreRunMessage(TCommand command, object[] state) + public PreRunMessage(TCommand command, ChocolateyConfiguration configuration, object[] state) { Command = command; + this.Configuration = configuration; State = state; } } diff --git a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs index 3b388f038c..7ec17fd60b 100644 --- a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs +++ b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs @@ -144,7 +144,7 @@ public void run(ChocolateyConfiguration config, Container container, bool isCons fail_when_license_is_missing_or_invalid_if_requested(config); - EventManager.publish(new PreRunMessage()); + EventManager.publish(new PreRunMessage(config)); var command = find_command(config, container, isConsole, parseArgs); if (command != null) @@ -153,7 +153,7 @@ public void run(ChocolateyConfiguration config, Container container, bool isCons command.run(config); } - EventManager.publish(new PostRunMessage()); + EventManager.publish(new PostRunMessage(config)); foreach (var task in tasks.or_empty_list_if_null()) {