public Configuration(IEventAggregator theEventAggregator)
        {
            myEventAggregator = theEventAggregator;
            myEventAggregator.GetEvent <AppExitEvent>().Subscribe(SaveConfigurationSettings);

            VideoConfiguration = new VideoSettings();
            SetupApplicationVariables();

            var aFileMap = new ExeConfigurationFileMap {
                ExeConfigFilename = HookFile
            };

            if (!File.Exists(aFileMap.ExeConfigFilename))
            {
                throw new Exception("Configuration file could not be found :" + aFileMap.ExeConfigFilename);
            }

            // Load configuration
            var aOpenMappedExeConfiguration = ConfigurationManager.OpenMappedExeConfiguration(aFileMap,
                                                                                              ConfigurationUserLevel.None);
            var aConfigurationSection = aOpenMappedExeConfiguration.GetSection("hook");
            var aHook = aConfigurationSection as Hook;

            if (aHook == null)
            {
                Log.Error("No Hooks configured! No command targeted for FFMPEG. CAM Recorder may not work!");
                return;
            }

            var aEnumerator = aHook.Commands.GetEnumerator();

            do
            {
                var aCurrent = aEnumerator.Current as Command;
                if (aCurrent == null)
                {
                    continue;
                }
                myConfiguredHooks.Add(new EncoderInfo()
                {
                    HookId    = aCurrent.HookId,
                    Mode      = aCurrent.Mode,
                    ExeName   = aCurrent.Executable.Name,
                    ExePath   = aCurrent.Executable.ExeLocation,
                    Arguments = VariablesParser.ExpandVariables(aCurrent.Arguments.CommandLine)
                });
            } while (aEnumerator.MoveNext());
        }
 private void SetupApplicationVariables()
 {
     VariablesParser.PushVariable("VIDEO_LOCATION", VideoConfiguration.OutputLocation);
     VariablesParser.PushVariable("FPS", VideoConfiguration.FPS);
     VariablesParser.PushVariable("BITMAPS", VideoConfiguration.BitmapLocation);
 }