private void downloadProfileFiles(ref ISet <string> idSet) { foreach (var id in idSet) { GraphApiContentSaver.enqueueDownloadProfileFile(id); } }
public void beginProcessing() { IsRunning = true; while (userIdsToProcess.Count != 0 && !aborted) { if (currentDepth == maxDepth) { breakEnqueueNew(); } Stopwatch swatch = new Stopwatch(); swatch.Start(); var idToProcess = userIdsToProcess.Dequeue(); progressListener.setTaskInfo(idToProcess, messages.FriendList); progressListener.reportQueueChange(usersWereInQueue.Count - userIdsToProcess.Count, usersWereInQueue.Count, ref userIdsToProcess); SourceContentSaver friendsSaver = new FriendsSourceContentSaver(idToProcess); var friendList = friendsSaver.saveFileAndGetIds(); friendsSaver = null; friendList.ExceptWith(usersWereInQueue); if (enqueueNew) { usersWereInQueue.UnionWith(friendList); foreach (var userId in friendList) { userIdsToProcess.Enqueue(userId); } } friendList = null; //downloadProfileFiles(friendList); GraphApiContentSaver.enqueueDownloadProfileFile(idToProcess); progressListener.setTaskInfo(idToProcess, messages.Favorites); SourceContentSaver likesSaver = new LikesSourceContentSaver(idToProcess); var likesList = likesSaver.saveFileAndGetIds(); likesSaver = null; likesList.ExceptWith(downloadedPages); downloadedPages.UnionWith(likesList); downloadProfileFiles(ref likesList); likesList = null; swatch.Stop(); taskTime.Add(swatch.ElapsedMilliseconds); string estimatedTime = computeEstimatedTime(); progressListener.reportTaskDone(idToProcess, estimatedTime); int downloadedCount = usersWereInQueue.Count - userIdsToProcess.Count; if (downloadedCount >= nextDepthLevel) { nextDepthLevel = usersWereInQueue.Count; currentDepth++; } saveWorkStatus(); if (singleProcessProfiles < maxSingleProcessProfiles) { singleProcessProfiles++; } else { restartApplication(); } SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1); } IsRunning = false; if (aborted) { Application.Exit(); } else { waitForProfiles(); progressListener.reportFinnish(); } }