Пример #1
0
 public void AddFuncCode(string nodeXpath, FuncCode funcCode)
 {
     FuncTreeNode tmp = _funcTreeRoot.FindNodes(nodeXpath);
     //如果节点不存在
     if (tmp == null)
     {
         throw new Exception(string.Format("FuncTreeNode:[{0}] has't been defined",nodeXpath));
     }
     //如果funcCode已经注册
     if (tmp.Funcs.ContainsKey(funcCode.Name))
     {
         throw new Exception(string.Format("FuncCode:[{0}] has been registered", funcCode.Name));
     }
     else
     {
         tmp.Funcs.Add(funcCode.Name, funcCode);
     }
 }
Пример #2
0
        public void AddFuncCode(string nodeXpath, FuncCode funcCode)
        {
            FuncTreeNode tmp = _funcTreeRoot.FindNodes(nodeXpath);

            //如果节点不存在
            if (tmp == null)
            {
                throw new Exception(string.Format("FuncTreeNode:[{0}/{1}] has't been defined", _shellTypeName, nodeXpath));
            }
            //如果funcCode已经注册
            if (tmp.Funcs.ContainsKey(funcCode.Name))
            {
                throw new Exception(string.Format("FuncCode:[{0}/{1}/{2}] has been registered", _shellTypeName, nodeXpath, funcCode.Name));
            }
            else
            {
                tmp.Funcs.Add(funcCode.Name, funcCode);
            }
        }