private Hashtable LoadConfig() { try { ConfigurationBuilder builder = new ConfigurationBuilder(_filePath); builder.RegisterRootConfigurationObject(typeof(Alachisoft.NCache.Config.Dom.CachePortsConfigParameters)); builder.ReadConfiguration(); CachePortsConfigParameters[] newConfiguration = new CachePortsConfigParameters[builder.Configuration.Length]; builder.Configuration.CopyTo(newConfiguration, 0); return(ToHashtable(newConfiguration)); } catch (Exception ex) { return(new Hashtable()); } }
CachePortsConfigParameters [] ConvertToDom(Hashtable config) { CachePortsConfigParameters [] newConfig = new CachePortsConfigParameters[config.Count]; IDictionaryEnumerator enm = config.GetEnumerator(); int counter = 0; while (enm.MoveNext()) { CachePortsConfigParameters configParam = new CachePortsConfigParameters(); configParam.CacheId = enm.Key.ToString().ToLower(); configParam.MangementPort = Convert.ToInt32(enm.Value); newConfig[counter] = configParam; counter++; } return(newConfig); }