private static void LoadConfig() { string configFilePath = AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings["ElasticSearchClusterConfig"]; string xml = File.ReadAllText(configFilePath); _instance = XMLUtility.Deserialize <ElasticSearchClusterConfig>(xml); }
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); }
protected IEnumerable <T> DeserializeCollection(XmlReader reader) { object result = XMLUtility.Deserialize <ValueObjectCollection <T> >(reader); return((IEnumerable <T>)result); }
protected T Deserialize(XmlReader reader) { object result = XMLUtility.Deserialize <T>(reader); return((T)result); }
public static AppVersionConfig ReadConfig() { string xmlContent = File.ReadAllText(ConfigFile); return(XMLUtility.Deserialize <AppVersionConfig>(xmlContent)); }