示例#1
0
        private static void LoadConfig()
        {
            string configFilePath = AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings["ElasticSearchClusterConfig"];
            string xml            = File.ReadAllText(configFilePath);

            _instance = XMLUtility.Deserialize <ElasticSearchClusterConfig>(xml);
        }
示例#2
0
 public CachePolicys GetSettings()
 {
     Monitor.Enter(this);
     if (policys == null)
     {
         string xml = File.ReadAllText(string.Format("{0}\\{1}", AppDomain.CurrentDomain.BaseDirectory, cacheSettingFile));
         policys           = (CachePolicys)XMLUtility.Deserialize(xml, typeof(CachePolicys));
         localCachePolicys = new Dictionary <string, LocalCachePolicy>();
         foreach (LocalCachePolicy localCachePolicy in policys.LocalCachePolicys)
         {
             localCachePolicys.Add(localCachePolicy.PolicyName.ToLower(), localCachePolicy);
         }
         remoteCachePolicys = new Dictionary <string, RemoteCachePolicy>();
         foreach (RemoteCachePolicy remoteCachePolicy in policys.RemoteCachePolicys)
         {
             remoteCachePolicys.Add(remoteCachePolicy.PolicyName.ToLower(), remoteCachePolicy);
         }
     }
     Monitor.Exit(this);
     return(policys);
 }
示例#3
0
        protected IEnumerable <T> DeserializeCollection(XmlReader reader)
        {
            object result = XMLUtility.Deserialize <ValueObjectCollection <T> >(reader);

            return((IEnumerable <T>)result);
        }
示例#4
0
        protected T Deserialize(XmlReader reader)
        {
            object result = XMLUtility.Deserialize <T>(reader);

            return((T)result);
        }
示例#5
0
        public static AppVersionConfig ReadConfig()
        {
            string xmlContent = File.ReadAllText(ConfigFile);

            return(XMLUtility.Deserialize <AppVersionConfig>(xmlContent));
        }