static DefaultBootModuleLoaderHolder() {

			string moduleLoaderClass = ConfigurationManager.AppSettings ["boot.module.loader.class"]; 
			string moduleLoaderAssembly = ConfigurationManager.AppSettings ["boot.module.loader.assemby"]; 	
			if (moduleLoaderClass == "") {			
				INSTANCE = new LocalModuloLoader (); 		    	  	
			} else {

				if (moduleLoaderAssembly == "") {
					try {
						Assembly assembly = Assembly.LoadFile (".\\MonoBoss.Kernel.dll"); 
						Type t = assembly.GetType ( moduleLoaderClass);
						INSTANCE = (ModuleLoader)Activator.CreateInstance (t);
						if (INSTANCE == null) {
							throw new ModuleLoaderException ("Cant'load assembly bootloader");
						}
				
					}catch ( ModuleLoaderException ex) {
						throw new ApplicationException (ex.ToString());
					}catch(Exception ex) {
					throw new ApplicationException ( "[Module Loader] " + ex.ToString());
				}

				
				} else {
				
					try {

						Assembly assembly = Assembly.LoadFile (moduleLoaderAssembly); 
						Type t = assembly.GetType(moduleLoaderClass);
						INSTANCE = (ModuleLoader) Activator.CreateInstance(t); 
						if (INSTANCE == null) {
							throw new ModuleLoaderException ("Cant'load assembly bootloader");
						}

					}catch ( ModuleLoaderException ex ) {
						throw new ApplicationException (ex.ToString());
					}catch(Exception ex) {
						throw new ApplicationException ( "[Module Loader] " + ex.ToString());
					}
							
				} 

			} 

		}
        static DefaultBootModuleLoaderHolder()
        {
            string moduleLoaderClass    = ConfigurationManager.AppSettings ["boot.module.loader.class"];
            string moduleLoaderAssembly = ConfigurationManager.AppSettings ["boot.module.loader.assemby"];

            if (moduleLoaderClass == "")
            {
                INSTANCE = new LocalModuloLoader();
            }
            else
            {
                if (moduleLoaderAssembly == "")
                {
                    try {
                        Assembly assembly = Assembly.LoadFile(".\\MonoBoss.Kernel.dll");
                        Type     t        = assembly.GetType(moduleLoaderClass);
                        INSTANCE = (ModuleLoader)Activator.CreateInstance(t);
                        if (INSTANCE == null)
                        {
                            throw new ModuleLoaderException("Cant'load assembly bootloader");
                        }
                    }catch (ModuleLoaderException ex) {
                        throw new ApplicationException(ex.ToString());
                    }catch (Exception ex) {
                        throw new ApplicationException("[Module Loader] " + ex.ToString());
                    }
                }
                else
                {
                    try {
                        Assembly assembly = Assembly.LoadFile(moduleLoaderAssembly);
                        Type     t        = assembly.GetType(moduleLoaderClass);
                        INSTANCE = (ModuleLoader)Activator.CreateInstance(t);
                        if (INSTANCE == null)
                        {
                            throw new ModuleLoaderException("Cant'load assembly bootloader");
                        }
                    }catch (ModuleLoaderException ex) {
                        throw new ApplicationException(ex.ToString());
                    }catch (Exception ex) {
                        throw new ApplicationException("[Module Loader] " + ex.ToString());
                    }
                }
            }
        }
Exemplo n.º 3
0
 public override void initialize()
 {
     currentModuleLoader = DefaultBootModuleLoaderHolder.INSTANCE;
     // Carica il modulo MSC
 }