예제 #1
0
        /// <summary>
        /// 既存の項目があれば上書き、なければ追加
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="user"></param>
        public static void Update(this UserDataManager manager, UserData user)
        {
            var userData = manager.FirstOrDefault(x => x.LiveName.Equals(user.LiveName) && x.UserID.Equals(user.UserID));

            if (userData is not null)
            {
                userData.HideUser  = user.HideUser;
                userData.UserName  = user.UserName;
                userData.BackColor = user.BackColor;
            }
            else
            {
                manager.Add(user);
            }
        }
예제 #2
0
 public static UserData Find(this UserDataManager manager, string liveName, string userId)
 => manager.FirstOrDefault(x => x.LiveName.Equals(liveName) && x.UserID.Equals(userId));