Пример #1
0
        //public static string LibraryDir = "D:\\shared_devel\\EVEL\\Release\\bin\\lib";
        //public static string LibraryDir = "D:\\Devel\\.NET\\cs\\EVEL\\Release\\bin\\lib\\";

        protected AvailableAssemblies(string path)
        {
            //LibraryDir = Path.Combine(Environment.CurrentDirectory, "lib");
            //const string userRoot = "HKEY_CURRENT_USER";
            //const string subkey = "Evel";
            //const string keyName = userRoot + "\\" + subkey;

            //Microsoft.Win32.Registry.SetValue(keyName, "libpath", "E:\\dotnet\\projects\\EVEL\\Release\\bin\\lib");
            //models
            this._availableModels = new List <ModelDescription>();
            AvailablePlugin[] plugs = PluginServices.getPlugins(path, "IModel", null);
            foreach (AvailablePlugin plugin in plugs)
            {
                //using (
                IModel           model = (IModel)PluginServices.getPluginInstance(plugin);//) {
                ModelDescription md    = new ModelDescription();
                md.name             = model.Name;
                md.description      = model.Description;
                md.groupDefinitions = model.GroupsDefinition;
                md.projectType      = model.ProjectType;
                md.plugin           = plugin;
                this._availableModels.Add(md);
                //}
            }
            //projects


            this._availableProjects = new List <ProjectDescription>();
            Type projectBaseType = typeof(ProjectBase);

            ConstructorInfo[] constructors = projectBaseType.GetConstructors();
            plugs = PluginServices.getPlugins(path, "IProject", constructors);
            foreach (AvailablePlugin plugin in plugs)
            {
                IProject           project = (IProject)PluginServices.getPluginInstance(plugin, new object[] { });
                ProjectDescription pd      = new ProjectDescription();
                pd.name                   = project.Name;
                pd.description            = project.Description;
                pd.experimentalMethodName = project.ExperimentalMethodName;
                pd.plugin                 = plugin;
                pd.projectType            = project.GetType();
                this._availableProjects.Add(pd);
            }
        }
Пример #2
0
        private AvailableGUIAssemblies()
        {
            this._availableGUIs = new List <GUIDescription>();
            Type defaultGroupGUIType = typeof(DefaultGroupGUI);

            ConstructorInfo[] constructors = defaultGroupGUIType.GetConstructors();
            AvailablePlugin[] plugs        = PluginServices.getPlugins(AvailableAssemblies.LibraryDir, "IGroupGUI", constructors);
            if (plugs != null)
            {
                foreach (AvailablePlugin plugin in plugs)
                {
                    IGroupGUI      gui = (IGroupGUI)PluginServices.getPluginInstance(plugin);//) {
                    GUIDescription gd  = new GUIDescription();
                    gd.plugin      = plugin;
                    gd.projectType = gui.ProjectType;
                    this._availableGUIs.Add(gd);
                }
            }
        }