public void setChattingCount(long userKey, ulong count) { CUser userInfo = getUserInfo(userKey); if (userInfo.UserKey > 0) { userInfo.chattingCount = count; } }
public void addMessage(long userKey, string message, DateTime time) { CMessage userMessage = new CMessage(); CUser userInfo = getUserInfo(userKey); userMessage.Message = message; userMessage.Time = time; userInfo.addMessage(userMessage); }
// 유저키로 유저 정보 얻어옴 public CUser getUserInfo(long userKey) { if (userInfo.ContainsKey(userKey) == true) { return(userInfo[userKey]); } CUser tempUserInfo = new CUser(); return(tempUserInfo); }
// 유저 추가 public void addUserInfo(long userKey, CUser user) { if (userKey <= 0) { // 유저 키가 없음 return; } userInfo.Add(userKey, user); userCount++; }
public void increaseChattingCount(long userKey) { CUser userInfo = getUserInfo(userKey); if (userInfo.UserKey > 0) { userInfo.chattingCount++; // 파일에 백업 System.IO.File.WriteAllText(@"Data/Chatting/" + "ChattingCount_" + userKey.ToString() + ".txt", userInfo.chattingCount.ToString() + "\n", Encoding.UTF8); } }
public void addMemo(long userKey, string memoString) { CMemo memo = new CMemo(); CUser userInfo = getUserInfo(userKey); memo.Memo = memoString; userInfo.addMemo(memo); // 파일에 백업 System.IO.File.AppendAllText(@"Data/Memo/" + "Memo_" + userKey + ".txt", memoString + "\n", Encoding.UTF8); }
// 대화명으로 유저 정보 얻어옴 public CUser getUserInfoByName(string name) { foreach (var iter in userInfo) { if (iter.Value.Name.Contains(name) == true) { return(iter.Value); } } CUser tempUserInfo = new CUser(); return(tempUserInfo); }
public void addPrivateNoti(long userKey, string userID, string notiString, int hour, int min) { CPrivateNoti privateNoti = new CPrivateNoti(); CUser userInfo = getUserInfo(userKey); privateNoti.Notice = notiString; privateNoti.Hour = hour; privateNoti.Minute = min; privateNoti.UserID = userID; userInfo.addPrivateNoti(privateNoti); // 파일에 백업 System.IO.File.AppendAllText(@"Data/Noti/" + "Noti_" + userKey + ".txt", hour + "|" + min + "|" + userID + "|" + notiString + "\n", Encoding.UTF8); }
// 유저 정보 갱신 public bool refleshUserInfo(long userKey, CUser user) { if (userInfo.ContainsKey(userKey) == false) { return(false); } userInfo[userKey].Name = user.Name; userInfo[userKey].MainBattleTag = user.MainBattleTag; userInfo[userKey].SubBattleTag = user.SubBattleTag; userInfo[userKey].Position = user.Position; userInfo[userKey].MostPick = user.MostPick; userInfo[userKey].OtherPick = user.OtherPick; userInfo[userKey].Team = user.Team; userInfo[userKey].Youtube = user.Youtube; userInfo[userKey].Twitch = user.Twitch; userInfo[userKey].Info = user.Info; return(true); }
public void resetChattingCount(long userKey = 0) { if (userKey == 0) { foreach (var iter in userInfo) { iter.Value.chattingCount = 0; } if (System.IO.Directory.Exists(@"Data/Chatting/")) { string[] files = System.IO.Directory.GetFiles(@"Data/Chatting/"); foreach (string file in files) { string fileName = System.IO.Path.GetFileName(file); string deletefile = @"Data/Chatting/" + fileName; System.IO.File.Delete(deletefile); } } return; } CUser user = getUserInfo(userKey); if (user.UserKey > 0) { user.chattingCount = 0; } string filePath = @"Data/Chatting/" + "ChattingCount_" + userKey.ToString() + ".txt"; if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } }
public List <CMemo> getMemo(long userKey) { CUser userInfo = getUserInfo(userKey); return(userInfo.getMemoList()); }
public List <CPrivateNoti> getPrivateNoti(long userKey) { CUser userInfo = getUserInfo(userKey); return(userInfo.getPrivateNoti()); }
public List <CMessage> getMessage(long userKey) { CUser userInfo = getUserInfo(userKey); return(userInfo.getMessage()); }