Esempio n. 1
0
        public string TryGetValue(string path)
        {
            path = path.Replace("\\", "/");
            int f = path.IndexOf("/");

            if (f == -1)
            {
                string v;
                if (Attributes.TryGetValue(path, out v))
                {
                    return(v);
                }
                return(null);
            }
            string name = path.Substring(0, f);

            SettingNode node = Nodes.FirstOrDefault(o => o.Name == name);

            if (node == null)
            {
                return(null);
            }

            return(node.TryGetValue(path.Substring(f + 1)));
        }
Esempio n. 2
0
 /// <summary>
 /// 尝试创建缓存实例
 /// </summary>
 /// <param name="node">允许为空</param>
 /// <param name="typePath"></param>
 /// <returns></returns>
 public static ICache TryCreateCache(SettingNode node, string typePath)
 {
     if (node != null)
     {
         string typeName = node.TryGetValue(typePath);
         if (!String.IsNullOrEmpty(typeName))
         {
             Type type = Type.GetType(typeName);
             return((ICache)FastActivator.Create(type));
         }
     }
     return(null);
 }
Esempio n. 3
0
 public string TryGetValue(string path)
 {
     return(rootNode.TryGetValue(path));
 }