Example #1
0
        //============================================================
        public IAopNode Find(string type, string name)
        {
            IAopNodes configs = _nodesCollection[type];

            if (configs != null)
            {
                return(configs.Find(name));
            }
            return(null);
        }
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);
             }
         }
     }
 }