コード例 #1
0
        private void SaveLogDict()
        {
            foreach (var file in IOTool.GetFiles(GetChatDirPath()))
            {
                file.Delete();
            }

            foreach (var userID in _chatLogDict.Keys)
            {
                string filePath = GetChatDirPath() + "/" + userID;
                IOTool.SerializeToFile <ChatLog>(filePath, _chatLogDict[userID]);
            }
        }
コード例 #2
0
        private void SaveFriendDict()
        {
            foreach (var file in IOTool.GetFiles(GetContactsDirPath()))
            {
                file.Delete();
            }

            foreach (var userID in _friendDict.Keys)
            {
                string filePath = GetContactsDirPath() + "/" + userID;
                IOTool.SerializeToFile <UserItem>(filePath, _friendDict[userID]);
            }
        }
コード例 #3
0
        private void SaveGroupDict()
        {
            foreach (var file in IOTool.GetFiles(GetGroupDirPath()))
            {
                file.Delete();
            }

            foreach (var groupID in _groupDict.Keys)
            {
                string filePath = GetGroupDirPath() + "/" + groupID;
                IOTool.SerializeToFile <GroupItem>(filePath, _groupDict[groupID]);
            }
        }
コード例 #4
0
 private void LoadLogDict()
 {
     ClearLogDict();
     if (IOTool.IsDirExist(GetChatDirPath()))
     {
         foreach (var file in IOTool.GetFiles(GetChatDirPath()))
         {
             ChatLog chatLog = IOTool.DeserializeFromFile <ChatLog>(file.FullName);
             if (chatLog != null)
             {
                 _chatLogDict[chatLog.chatID] = chatLog;
             }
         }
     }
 }
コード例 #5
0
 private void LoadFriendDict()
 {
     ClearFriendDict();
     if (_friendDict.Count == 0 && IOTool.IsDirExist(GetContactsDirPath()))
     {
         foreach (var file in IOTool.GetFiles(GetContactsDirPath()))
         {
             UserItem userItem = IOTool.DeserializeFromFile <UserItem>(file.FullName);
             if (userItem != null)
             {
                 _friendDict[userItem.userId] = userItem;
             }
         }
     }
 }
コード例 #6
0
 private void LoadGroupDict()
 {
     ClearGroupDict();
     if (_groupDict.Count == 0 && IOTool.IsDirExist(GetGroupDirPath()))
     {
         foreach (var file in IOTool.GetFiles(GetGroupDirPath()))
         {
             GroupItem groupItem = IOTool.DeserializeFromFile <GroupItem>(file.FullName);
             if (groupItem != null)
             {
                 _groupDict[groupItem.groupId] = groupItem;
             }
         }
     }
 }