Пример #1
0
        /// <inheritdoc />
        public void Initialize()
        {
            ThrowIfDisposed();

            try
            {
                ConfigureForDebugging();

                SetRuntimePath();
                SetInstallationConfiguration();

                ConfigureDefaultPluginDirectories();
                ConfigurePluginDirectoriesFromSetup();
                ConfigurePluginDirectoriesFromInstallationConfiguration();
                ConfigurePluginLoaderForInstallationId();

                RegisterBuiltInComponents();
                RegisterLoadedPlugins();

                foreach (IPluginDescriptor pluginDescriptor in registry.Plugins)
                {
                    if (!pluginDescriptor.IsDisabled &&
                        pluginDescriptor.EnableCondition != null &&
                        !pluginDescriptor.EnableCondition.Evaluate(conditionContext))
                    {
                        pluginDescriptor.Disable(string.Format("The plugin enable condition was not satisfied.  "
                                                               + "Please note that this is the intended behavior for plugins that must be hosted inside third party applications in order to work.  "
                                                               + "Enable condition: '{0}'.", pluginDescriptor.EnableCondition));
                    }
                }

                foreach (IPluginDescriptor pluginDescriptor in registry.Plugins)
                {
                    if (!pluginDescriptor.IsDisabled)
                    {
                        foreach (string searchPath in pluginDescriptor.GetSearchPaths(null))
                        {
                            assemblyLoader.AddHintDirectory(searchPath);
                        }
                    }
                }

                LogDisabledPlugins();
            }
            catch (Exception ex)
            {
                throw new RuntimeException(Resources.DefaultRuntime_RuntimeCannotBeInitialized, ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Installs a global assembly resolver given the specified runtime path.
        /// </summary>
        /// <param name="runtimePath">The Gallio runtime path.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="runtimePath"/> is null.</exception>
        public static void Install(string runtimePath)
        {
            if (runtimePath == null)
            {
                throw new ArgumentNullException("runtimePath");
            }

            lock (syncRoot)
            {
                if (assemblyLoader != null)
                {
                    return;
                }

                assemblyLoader = new DefaultAssemblyLoader();
                assemblyLoader.AddHintDirectory(runtimePath);
            }
        }