public bool isSupportVersion(string version) { if (_rwLock.TryEnterReadLock(_readWaiteTime)) { try { GameConfigNotSupportVersion v = _configDic[(int)EnumConfigFileType.NotSupportVersion] as GameConfigNotSupportVersion; return(v.isSupport(version)); } catch { return(false); } finally { if (_rwLock.IsReadLockHeld) { _rwLock.ExitReadLock(); } } } else { return(false); } }
void Init() { IP.Start(); _configDic = new Dictionary <int, GameConfigBase>(); TimerMgr.Singleton().add(TimeId, update, 1000, 10000); GameConfigValue constValue = new GameConfigValue(configFileFolderName + EnumConfigFileType.ConstValues.ToString()); constValue.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.ConstValues, constValue); GameConfigUI gcu = new GameConfigUI(configFileFolderName + EnumConfigFileType.UI.ToString()); gcu.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.UI, gcu); GameConfigActivity Activity = new GameConfigActivity(configFileFolderName + EnumConfigFileType.Activity.ToString()); Activity.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.Activity, Activity); GameConfigOpenClose OpenClose = new GameConfigOpenClose(configFileFolderName + EnumConfigFileType.OpenClose.ToString()); OpenClose.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.OpenClose, OpenClose); GameConfigNotSupportVersion NotSupportVersion = new GameConfigNotSupportVersion(configFileFolderName + EnumConfigFileType.NotSupportVersion.ToString()); NotSupportVersion.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.NotSupportVersion, NotSupportVersion); GameConfigExchangeCode exchangeCode = new GameConfigExchangeCode(configFileFolderName + EnumConfigFileType.ExchangeCode.ToString()); exchangeCode.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.ExchangeCode, exchangeCode); GameConfigRankingReward rankingReward = new GameConfigRankingReward(configFileFolderName + EnumConfigFileType.RankReward.ToString()); rankingReward.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.RankReward, rankingReward); GameConfigProducts items = new GameConfigProducts(configFileFolderName + EnumConfigFileType.Products.ToString()); items.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.Products, items); GameConfigHappyPoint happyPoint = new GameConfigHappyPoint(configFileFolderName + EnumConfigFileType.RealItems.ToString()); happyPoint.setLock(_rwLock); _configDic.Add((int)EnumConfigFileType.RealItems, happyPoint); foreach (GameConfigBase gcb in _configDic.Values) { gcb.init(); } update(null); }