Exemple #1
0
        public void LoadModulesInExecutionFolder()
        {
            ConsoleApplicationController.WriteToConsole("Loading Modules");
            var    codeBase = Assembly.GetExecutingAssembly().Location;
            var    uri      = new UriBuilder(codeBase);
            string path     = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path));

            foreach (string dll in Directory.GetFiles(path, "*.dll"))
            {
                var loadIt = Assembly.LoadFile(dll);
                foreach (var type in loadIt.GetTypes())
                {
                    if (type.IsTypeOf(typeof(ModuleBase)) && !type.IsGenericType && !type.IsAbstract)
                    {
                        AddModule(type);
                    }
                }
            }

            var commands = GetCommandOptions();

            if (!commands.Any())
            {
                throw new NullReferenceException(string.Format("No {0} Implementing {1} Was Found In The Execution Folder '{2}'", nameof(ModuleBase), nameof(ICommandLineExecutable), codeBase));
            }
        }
Exemple #2
0
        public void LoadModulesInExcecutionFolder()
        {
            ConsoleApplicationController.WriteToConsole("Loading Modules");
            var    codeBase = Assembly.GetExecutingAssembly().Location;
            var    uri      = new UriBuilder(codeBase);
            string path     = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path));

            foreach (string dll in Directory.GetFiles(path, "*.dll"))
            {
                var loadIt = Assembly.LoadFile(dll);
                foreach (var type in loadIt.GetTypes())
                {
                    if (type.IsTypeOf(typeof(ModuleBase)) && !type.IsGenericType && !type.IsAbstract)
                    {
                        AddModule(type);
                    }
                }
            }
        }
Exemple #3
0
 public ConsoleApplication(ConsoleApplicationController applicationController, IApplicationOptions applicationOptions, ISettingsManager settingsManager)
     : base(applicationController, applicationOptions, settingsManager)
 {
     ConsoleApplicationController = applicationController;
     Controller.RegisterType <IDialogController, ConsoleDialogController>();
 }