public TerrainLoadStore(ConfigurationLoader loader) { foreach (Type t in GetType().Assembly.GetTypes()) { if (t.GetCustomAttributes(typeof(TerrainStorageTypeAttribute), false).Length > 0 && t.GetInterfaces().Contains(typeof(IPlugin)) && t.GetInterfaces().Contains(typeof(ITerrainFileStorage))) { object o = Activator.CreateInstance(t); loader.AddPlugin(((ITerrainFileStorage)o).Name, (IPlugin)o); } } }
public void AddPlugins(ConfigurationLoader loader) { IConfig config = loader.Config.Configs["Tests"]; if (config == null) { m_Log.Fatal("Nothing to test"); throw new ConfigurationLoader.TestingErrorException(); } foreach (string testname in config.GetKeys()) { Type t = GetType().Assembly.GetType(testname); if (t == null) { m_Log.FatalFormat("Missing test {0}", testname); throw new ConfigurationLoader.TestingErrorException(); } loader.AddPlugin(testname, (IPlugin)Activator.CreateInstance(t)); } }