/// <summary> /// Makes start queue as default (root = _startUser) /// </summary> private void makeDefaultQueues() { if (_startQueue.Root.ID != _startUser.ID) { VKFriendsQueue temp = _startQueue; _startQueue = _targetQueue; _targetQueue = temp; } }
/// <summary> /// Swaps if start has more friends /// </summary> private void swapQueuesIfNeeded() { if (_startQueue.UserCount > _targetQueue.UserCount) { VKFriendsQueue temp = _startQueue; _startQueue = _targetQueue; _targetQueue = temp; } }
public VKConnectionFinder(VKUser start, VKUser target) { _startUser = start; _targetUser = target; _startQueue = new VKFriendsQueue(start); _targetQueue = new VKFriendsQueue(target); _path = new List <VKUser>(); _currLevel = 0; }
/// <summary> /// Get friends and adds to queue. /// </summary> /// <param name="user"></param> /// <param name="q"></param> /// <returns></returns> private async Task prepareUser(VKUser user, VKFriendsQueue q) { if (user.Childs.Count == 0) { q.addUser(user); FriendsFetcher fetcher = new FriendsFetcher(user); List <VKUser> friends = await fetcher.fetchFriends(); _status = fetcher.Status; foreach (VKUser usr in friends) { if (q.addUser(usr)) { user.addChild(usr); } } } }