TwitCore/Helpers/UserAnalyser.cs
/// <summary>
/// Adds a new user to the list of users.
/// </summary>
/// <param name="users">A list of all the users.</param>
/// <param name="userHandle">Handle of the user you would like to add.</param>
/// <param name="userFollowers">A list of string from the text file with potential followers.</param>
Adds a new user to the list of users.
Adds a new user to the list of users .
public static void AddUser(List<IPerson> users, string userHandle, List<String> userFollowers) {
            if(CheckIfUserExists(users, userHandle) == true) {
                var currentUser = users.Cast<User>().GetExistingUser(userHandle);
                if (currentUser.Following == null)
                    currentUser.Following = new List<IPerson>();
                currentUser.Following.AddFollowers(userFollowers);
                currentUser.Following.AddFollowersToUsers(users);
            }
            else {
                var followers = new List<IPerson>();
                followers.AddFollowers(userFollowers);
                users.Add(new User(userHandle, followers));
                followers.AddFollowersToUsers(users);
            }
        }
public static void AddUser ( List < IPerson > users , string userHandle , List < String > userFollowers ) { if ( CheckIfUserExists ( users , userHandle ) == true ) { var currentUser = users . Cast < User > ( ) . GetExistingUser ( userHandle ) ; if ( currentUser . Following == null ) currentUser . Following = new List < IPerson > ( ) ; currentUser . Following . AddFollowers ( userFollowers ) ; currentUser . Following . AddFollowersToUsers ( users ) ; } else { var followers = new List < IPerson > ( ) ; followers . AddFollowers ( userFollowers ) ; users . Add ( new User ( userHandle , followers ) ) ; followers . AddFollowersToUsers ( users ) ; } }
Adds a new user to the list of users.
Adds a new user to the list of users .
users
List<IPerson>
A list of all the users.
A list of all the users .
userHandle
string
Handle of the user you would like to add.
Handle of the user you would like to add .
userFollowers
List<String>
A list of string from the text file with potential followers.
A list of string from the text file with potential followers .