#region License Information
/* HeuristicLab
* Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace HeuristicLab.PluginInfrastructure {
///
/// Lightweight application manager is set as the application manager as long as the plugin infrastructure is uninitialized.
/// The list of plugins and applications is empty. The default application manager is necessary to provide the type discovery
/// functionality in unit tests.
///
internal sealed class LightweightApplicationManager : IApplicationManager {
internal LightweightApplicationManager() {
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}
Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) {
return null;
}
#region IApplicationManager Members
///
/// Gets an empty list of plugins. (LightweightApplicationManager doesn't support plugin discovery)
///
public IEnumerable Plugins {
get { return new IPluginDescription[0]; }
}
///
/// Gets an empty list of applications. (LightweightApplicationManager doesn't support application discovery)
///
public IEnumerable Applications {
get { return new IApplicationDescription[0]; }
}
///
/// Creates an instance of all types that are subtypes or the same type of the specified type
///
/// Most general type.
/// Enumerable of the created instances.
public IEnumerable GetInstances() where T : class {
return GetInstances(typeof(T)).Cast();
}
///
/// Creates an instance of all types that are subtypes or the same type of the specified type
///
/// Most general type.
/// Enumerable of the created instances.
public IEnumerable