static bool addHappyDataMap(HappyModeData hmd, int newId) { var happMapCache = new PersonalCacheStruct <The3rdUserIDMap>(); var map = happMapCache.FindKey("888"); string type = "YYS_CP360"; uint id = utils.KeyInt2Uint(hmd.the3rdUserId); int mapID = newId; if (hmd.the3rdUserId > 0) { mapID = hmd.the3rdUserId; } string mapKey = Action1005.getMapKey(type, id.ToString()); if (map.the3rdMap.ContainsKey(mapKey)) { return(false); } map.ModifyLocked(() => { map.the3rdMap.Add(mapKey, mapID); }); if (hmd.the3rdUserId > 0) { return(false); } return(true); }
void doAdd_RemoveMap(string parm) { string[] strs = parm.Split(','); string opt = strs[0]; string type = strs[1]; string the3rdID = strs[2]; string key = Action1005.getMapKey(type, the3rdID); var cache = new PersonalCacheStruct <The3rdUserIDMap>(); var Da = cache.FindKey("888"); if (opt == "del") { if (Da.the3rdMap.ContainsKey(key)) { Da.the3rdMap.Remove(key); ConsoleLog.showErrorInfo(0, "del map key:" + key); } else { ConsoleLog.showErrorInfo(0, "del not find map key:" + key); } } else if (opt == "add") { if (Da.the3rdMap.ContainsKey(key)) { ConsoleLog.showErrorInfo(0, "add map key had find:" + key); } else { int happyID = int.Parse(strs[3]); Da.the3rdMap.Add(key, happyID); ConsoleLog.showErrorInfo(0, "add map key add :" + key); } } else if (opt == "addNew") { if (Da.the3rdMap.ContainsKey(key)) { ConsoleLog.showErrorInfo(0, "addNew map key had find:" + key); } else { int happyID = Action1005.getHappyIndex(type, the3rdID); Da.the3rdMap.Add(key, happyID); ConsoleLog.showErrorInfo(0, "addNew map key add :" + key + ":" + the3rdID); } } }
void doAdd_reCreateHappy(string parm) { var cache = new PersonalCacheStruct <HappyModeData>(); cache.LoadFrom(null); var mapCache = new PersonalCacheStruct <The3rdUserIDMap>(); var mapData = mapCache.FindKey("888"); if (null == mapData) { mapData = new The3rdUserIDMap(); mapData.Index = 888; mapCache.Add(mapData); } string mapKey = ""; cache.Foreach((string a, string b, HappyModeData hmd) => { mapKey = Action1005.getMapKey(parm, hmd.the3rdUserId.ToString()); mapData.the3rdMap.Add(mapKey, hmd.the3rdUserId); return(true); }); }