Пример #1
0
 protected virtual Boolean LoadModule(ModuleConfig config)
 {
     if ((config != null) && config.IsInstance())
     {
         return(CreateInstance(config));
     }
     return(false);
 }
Пример #2
0
 protected virtual Boolean FindInstance(ModuleConfig config)
 {
     if (modules != null)
     {
         IEnumerator enumerator = modules.GetEnumerator();
         if (enumerator != null)
         {
             while (enumerator.MoveNext())
             {
                 ModuleConfig instance = enumerator.Current as ModuleConfig;
                 if (instance != null && instance.IsInstance())
                 {
                     if (instance.HasProperty("Key") && instance.GetConfigurationProperty("Key") == config.GetConfigurationProperty("Key"))
                     {
                         config.Instance = instance.Instance;
                         return(config.Instance != null);
                     }
                 }
             }
         }
     }
     return(false);
 }
Пример #3
0
        protected virtual Boolean CreateInstances(IEnumerator moduleEnum, int depth, ModuleConfig parent = null)
        {
            bool result = true;

            while (moduleEnum.MoveNext())
            {
                ModuleConfig moduleConfig = moduleEnum.Current as ModuleConfig;
                if (moduleConfig != null)
                {
                    if (moduleConfig.IsInstance())
                    {
                        moduleConfig.Parent = parent;
                        moduleInstances[moduleConfig.UniqueId] = moduleConfig;
                        result = LoadModules(moduleConfig, depth + 1) && result;
                        result = LoadModule(moduleConfig) && result;
                    }
                    else
                    {
                        moduleReferences[moduleConfig.UniqueId] = moduleConfig;
                    }
                }
            }
            return(result);
        }