private void _setValue(Define.Ccm_status ccm) { switch (ccm) { case Define.Ccm_status.NONE: this.m_status = 0; break; case Define.Ccm_status.LOADING_MAINFILE: this.m_status = 1; break; case Define.Ccm_status.LOADING_CONF: this.m_status = 2; break; case Define.Ccm_status.FORMAT_CONF: this.m_status = 3; break; case Define.Ccm_status.LOADED: this.m_status = 4; break; case Define.Ccm_status.ERR: this.m_status = 5; break; } }
public void loadConfigs(string mainConfFile, Action onFin) { bool flag = mainConfFile.IndexOf('.') < 0; if (flag) { mainConfFile += ".xml"; } os.sys.parseXMLFromFile(mainConfFile, delegate(Variant mainConf1) { bool flag2 = mainConf1 != null; if (flag2) { List <string> toLoadNames = new List <string>(); List <string> list = new List <string>(); foreach (string current in mainConf1.Keys) { Variant variant = mainConf1[current][0]; bool flag3 = variant.ContainsKey("file"); if (flag3) { toLoadNames.Add(current); list.Add(variant["file"]._str); } else { bool flag4 = this.m_confFormatFuncMap.ContainsKey(current); if (flag4) { this.m_ccm = Define.Ccm_status.FORMAT_CONF; this._setValue(this.m_ccm); Action <Variant> action = this.m_confFormatFuncMap[current]; action(variant); } this.m_configs[current] = variant; this.m_configLoaded++; } } this.m_ccm = Define.Ccm_status.LOADING_CONF; this._setValue(this.m_ccm); for (int i = 0; i < toLoadNames.Count; i++) { string key = toLoadNames[i]; string url = list[i]; os.sys.parseXMLFromFile(url, delegate(Variant confObj1) { bool flag5 = confObj1 != null; if (flag5) { bool flag6 = this.m_confFormatFuncMap.ContainsKey(key); if (flag6) { this.m_ccm = Define.Ccm_status.FORMAT_CONF; this._setValue(this.m_ccm); Action <Variant> action2 = this.m_confFormatFuncMap[key]; action2(confObj1); } this.m_configs[key] = confObj1; this.m_configLoaded++; } else { string text = "Config Manager load config file[" + url + "] error! msg:" + key; DebugTrace.add(Define.DebugTrace.DTT_ERR, text); this.m_errMsg = this.m_errMsg + text + "\n"; this.m_configFailed++; } bool flag7 = this.m_configLoaded + this.m_configFailed == toLoadNames.Count; if (flag7) { this.m_ccm = Define.Ccm_status.LOADED; this._setValue(this.m_ccm); this.m_curProcessConf = null; onFin(); } }); } } else { this.m_errMsg = "Config Manager load main config file[] error! msg:" + mainConfFile; DebugTrace.add(Define.DebugTrace.DTT_ERR, this.m_errMsg); this.m_ccm = Define.Ccm_status.ERR; this._setValue(this.m_ccm); onFin(); } this.m_ccm = Define.Ccm_status.LOADING_MAINFILE; this._setValue(this.m_ccm); }); }