Beispiel #1
0
        public static UserInfo Add(QQSourceInfo qqInfo)
        {
            var hasUpdate = false;

            if (!Users.ContainsKey(qqInfo.Id))
            {
                hasUpdate = true;
            }

            Users.AddOrUpdate(qqInfo.Id, new UserInfo(qqInfo), (key, source) =>
            {
                if (source.Nick != qqInfo.Nick || source.Sex != qqInfo.Sex)
                {
                    hasUpdate   = true;
                    source.Nick = qqInfo.Nick;
                    source.Sex  = qqInfo.Sex;
                }
                return(source);
            });

            if (hasUpdate)
            {
                DataManager.Instance.NoticeConfigUpdated();
            }

            return(Users.TryGetValue(qqInfo.Id, out var user) ? user : null);
        }
Beispiel #2
0
 public UserInfo(QQSourceInfo qqSourceInfo)
 {
     Id   = qqSourceInfo.Id;
     Nick = qqSourceInfo.Nick;
     Sex  = qqSourceInfo.Sex;
 }