public int ReloadPlatConfig() { Dictionary <string, string> normalDict = new Dictionary <string, string>(); Dictionary <int, WaitingConfig> waitingDict = new Dictionary <int, WaitingConfig>(); List <TradeLevelLimitConfig> tradeLevelLimitList = new List <TradeLevelLimitConfig>(); Dictionary <ChatTypeIndexes, List <ChatLevelLimitConfig> > chatLevelLimitDic = new Dictionary <ChatTypeIndexes, List <ChatLevelLimitConfig> >(); try { XElement xml = XElement.Load(Global.GameResPath(this.fileName)); this.LoadNormalConfig(xml, normalDict); this.LoadWaitingConfig(xml, waitingDict); this.LoadTradeLevelLimitConfig(xml, tradeLevelLimitList); this.LoadChatLevelLimitConfig(xml, chatLevelLimitDic); this._PlatConfigTradeLimitConfigDict = this.LoadTradeLimitsConfig(xml); } catch (Exception e) { LogManager.WriteException("重新加载配置文件 PlatConfig.xml 失败!!!" + e.ToString()); return(-1); } lock (this._PlatConfigNormalDict) { this._PlatConfigNormalDict = normalDict; } lock (this._PlatConfigWaitingDict) { this._PlatConfigWaitingDict = waitingDict; } lock (this._PlatConfigTradeLevelLimitList) { this._PlatConfigTradeLevelLimitList = tradeLevelLimitList; } lock (this._PlatConfigChatLevelLimitDic) { this._PlatConfigChatLevelLimitDic = chatLevelLimitDic; } TCPSession.SetMaxPosCmdNumPer5Seconds(8); GameManager.loginWaitLogic.LoadConfig(); return(0); }
/// <summary> /// 重新加载文件 /// </summary> /// <returns></returns> public int ReloadPlatConfig() { Dictionary <string, string> normalDict = new Dictionary <string, string>(); Dictionary <int, WaitingConfig> waitingDict = new Dictionary <int, WaitingConfig>(); List <TradeLevelLimitConfig> tradeLevelLimitList = new List <TradeLevelLimitConfig>(); try { XElement xml = XElement.Load(Global.GameResPath(fileName)); LoadNormalConfig(xml, normalDict); LoadWaitingConfig(xml, waitingDict); LoadTradeLevelLimitConfig(xml, tradeLevelLimitList); } catch (Exception e) { LogManager.WriteException("重新加载配置文件 PlatConfig.xml 失败!!!" + e.ToString()); return(-1); } //没有异常,说明reload的配置文件没有错 //可以把相关字典替换掉替换了 lock (_PlatConfigNormalDict) { _PlatConfigNormalDict = normalDict; } lock (_PlatConfigWaitingDict) { _PlatConfigWaitingDict = waitingDict; } lock (_PlatConfigTradeLevelLimitList) { _PlatConfigTradeLevelLimitList = tradeLevelLimitList; } //重新Load配置文件后要重新设定MaxPosCmdNumPer5Seconds的值 TCPSession.SetMaxPosCmdNumPer5Seconds(8); //更新登录配置 GameManager.loginWaitLogic.LoadConfig(); return(0); }