static public ModuleImplementation GetModuleType(string moduleType) { ModuleImplementation implementation = null; _instance._moduleTypes.TryGetValue(moduleType, out implementation); return(implementation); }
static private IEnumerable <IModuleDescriptor> _LoadModuleDescriptors(IEnumerable <string> filePaths) { List <IModuleDescriptor> descriptors = new List <IModuleDescriptor>(); foreach (string filePath in filePaths) { try { // Determine what kind of module it is so its descriptor can be added // to that implementation's descriptor list. ModuleImplementation moduleImplementation = _FindImplementation(filePath); if (moduleImplementation == null) { VixenSystem.Logging.Error("File " + filePath + " was not loaded because its module type could not be determined."); continue; } // Try to get descriptors. IEnumerable <IModuleDescriptor> descriptorsFound = _LoadModuleDescriptors(filePath); descriptors.AddRange(descriptorsFound); _moduleImplementationDescriptors[moduleImplementation].AddRange(descriptorsFound); } catch (BadImageFormatException) { } catch (ReflectionTypeLoadException ex) { foreach (Exception loaderException in ex.LoaderExceptions) { VixenSystem.Logging.Error("Loader exception:" + Environment.NewLine + loaderException.Message, loaderException); } } catch (Exception ex) { VixenSystem.Logging.Error("Error loading modules from " + filePath, ex); } } return(descriptors); }
private static void Main(string[] args) { CultureInfo culture = CultureInfo.CreateSpecificCulture("en"); culture.NumberFormat.NumberDecimalSeparator = "."; Thread.CurrentThread.CurrentCulture = culture; //Application.SetCompatibleTextRenderingDefault(false); Application.EnableVisualStyles(); Application.DoEvents(); MainForm newForm1 = MainForm.Instance; object oBox = newForm1; var oImpl = new ModuleImplementation( "AutoCSharp", "Auto CSharp", LowLevel.ModuleManagementType.UniqueModule, "Direct Interface to AUTO2000 with C# frontend"); oImpl.addService("auto", "Auto2000 (C#)", "/Analysis", "Direct Interface to AUTO2000 with C# frontend", ref oBox); oImpl.EnableServices(args); MainForm.IsSBWAvailable = true; Application.Run(newForm1); }
public static void Main(string[] args) { try { BifurcationForm.m_sModuleName = "Bifurcation"; m_oForm = new BifurcationForm(); updateService = new FrontendService(); object oFrontendObject = updateService; var oFrontendModule = new ModuleImplementation(BifurcationForm.m_sModuleName, "Bifurcation Frontend", LowLevel.ModuleManagementType.UniqueModule, "this module implements a frontend for the bifurcation discovery module"); oFrontendModule.addService("update", "Bifurcation Discovery Tool", "Analysis", "implementation of the update function that will be called by the bifurcation module", ref oFrontendObject); oFrontendModule.EnableServices(args); oFrontendModule.ModuleShutdown += oFrontendModule_ModuleShutdown; Application.EnableVisualStyles(); Application.DoEvents(); Application.Run(m_oForm); } catch (SBWException) { MessageBox.Show( "An exception occured while trying to register the module. The only possible explenation would be an outdated SBW DLL.", "Error druning module initialization"); } catch (Exception e) { MessageBox.Show(e.Message, "Error druning module initialization"); } }
static private string _GetModuleTypeDirectory(ModuleImplementation moduleImplementation) { string moduleTypeName = (moduleImplementation.GetType().GetCustomAttributes(typeof(TypeOfModuleAttribute), false).First() as TypeOfModuleAttribute).Name; string moduleTypeDirectory = Path.Combine(Directory, moduleTypeName); moduleImplementation.Path = moduleTypeDirectory; return(moduleTypeDirectory); }
static public IModuleDescriptor[] GetDescriptors(string typeOfModule) { ModuleImplementation moduleImplementation = _moduleImplementationDescriptors.Keys.FirstOrDefault(x => x.TypeOfModule == typeOfModule); if (moduleImplementation != null) { return(_moduleImplementationDescriptors[moduleImplementation].ToArray()); } return(null); }
static public IModuleRepository GetRepository <T>() where T : class, IModuleInstance { ModuleImplementation moduleImplementation = GetImplementation <T>(); if (moduleImplementation != null) { return(moduleImplementation.Repository); } return(null); }
static public IModuleManagement GetManager <T>() where T : class, IModuleInstance { ModuleImplementation moduleImplementation = GetImplementation <T>(); if (moduleImplementation != null) { return(moduleImplementation.Management); } return(null); }
static public U GetManager <T, U>() where T : class, IModuleInstance where U : class, IModuleManagement <T> { ModuleImplementation moduleImplementation = GetImplementation <T>(); if (moduleImplementation != null) { return(moduleImplementation.Management as U); } return(null); }
public static U GetRepository <T, U>() where T : class, IModuleInstance where U : class, IModuleRepository <T> { ModuleImplementation moduleImplementation = GetImplementation <T>(); if (moduleImplementation != null) { return(moduleImplementation.Repository as U); } return(null); }
/// <summary> /// /// </summary> /// <typeparam name="T">Module instance type as specified by its ModuleImplementation.</typeparam> /// <returns></returns> static public IModuleDescriptor[] GetDescriptors <T>() where T : class, IModuleInstance { ModuleImplementation moduleImplementation = GetImplementation <T>(); if (moduleImplementation != null) { HashSet <IModuleDescriptor> descriptors; if (_moduleImplementationDescriptors.TryGetValue(moduleImplementation, out descriptors)) { return(descriptors.ToArray()); } } return(null); }
static void Main(string[] args) { string fileName = null; foreach (string arg in args) { if (arg == "-r" || arg == "--run-test") { RunTest(args); return; } if (File.Exists(arg)) fileName = arg; } var culture = System.Globalization.CultureInfo.CreateSpecificCulture("en"); culture.NumberFormat.NumberDecimalSeparator = "."; Thread.CurrentThread.CurrentCulture = culture; try { Application.CurrentCulture = culture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); formInstance = new MainForm(); object instance = formInstance; var module = new ModuleImplementation( "FluxBalance", "Flux Balance Analsysis", LowLevel.ModuleManagementType.UniqueModule, "Module performing Flux Balance Analysis on SBML Models"); module.addService("analysis", "Flux Balance Analysis", "/Analysis", "Module performing Flux Balance Analysis on SBML Models", ref instance); module.ModuleShutdown += module_ModuleShutdown; module.EnableServices(args); if (fileName != null) formInstance.LoadSBMLFile(fileName); Application.Run(formInstance); } catch (Exception e) { Console.WriteLine(e); } }