Example #1
0
 public void Push(IAopNode config)
 {
     if (!_duplicate && _ids.Contains(config.Id))
     {
         throw new FFatalException("Has contains node(id={0})", config.Id);
     }
     base.Push((T)config);
     if (!RString.IsEmpty(config.Id))
     {
         _ids[config.Id] = (T)config;
     }
 }
Example #2
0
 //============================================================
 public void LoadConfig(FXmlNode config)
 {
     if (config != null && config.HasNode())
     {
         foreach (FXmlNode node in config.Nodes)
         {
             if (node.IsName(XAopConfig.TAG))
             {
                 // Register config node
                 XAopConfig aopConfig = new XAopConfig();
                 aopConfig.Console = this;
                 aopConfig.LoadConfig(node);
                 _configs.Push(aopConfig);
             }
             else if (node.IsName(XAopReference.TAG))
             {
                 // Register reference node
                 XAopReference aopReference = new XAopReference();
                 aopReference.Console = this;
                 aopReference.LoadConfig(node);
                 _references.Push(aopReference);
             }
             else
             {
                 // Find node type
                 XAopConfig aopConfig = (XAopConfig)_configs.Find(node.Name);
                 if (null == config)
                 {
                     throw new FFatalException("Node({1}) is not be defined.", node.Name);
                 }
                 // Sync node collection
                 IAopNodes configs = _nodesCollection[node.Name];
                 if (null == configs)
                 {
                     configs = aopConfig.CreateCollection <IAopNodes>();
                     _nodesCollection[node.Name] = configs;
                 }
                 // Create node instance
                 IAopNode aopCfg = aopConfig.CreateInstance <IAopNode>();
                 aopCfg.Console = this;
                 aopCfg.LoadConfig(node);
                 configs.Push(aopCfg);
             }
         }
     }
 }