Ejemplo n.º 1
0
        public async Task <IEnumerable <string> > ItemizeAllAsync(IStatus status)
        {
            var enumerateUpdateGameDetailsFilesTask = await statusController.CreateAsync(status, "Enumerate updated gameDetails files");

            var updatedIds = await updatedDataController.ItemizeAllAsync(enumerateUpdateGameDetailsFilesTask);

            var updatedIdsCount = await updatedDataController.CountAsync(enumerateUpdateGameDetailsFilesTask);

            var current = 0;

            var gameDetailsFiles = new List <string>();

            foreach (var id in updatedIds)
            {
                var gameDetails = await gameDetailsDataController.GetByIdAsync(id, enumerateUpdateGameDetailsFilesTask);

                await statusController.UpdateProgressAsync(
                    enumerateUpdateGameDetailsFilesTask,
                    ++current,
                    updatedIdsCount,
                    gameDetails.Title);

                gameDetailsFiles.AddRange(
                    await itemizeGameDetailsFilesAsyncDelegate.ItemizeAsync(
                        gameDetails,
                        enumerateUpdateGameDetailsFilesTask));
            }

            await statusController.CompleteAsync(enumerateUpdateGameDetailsFilesTask);

            return(gameDetailsFiles);
        }
Ejemplo n.º 2
0
        public override async Task ProcessActivityAsync(IStatus status)
        {
            var listUpdatedStatus = await statusController.CreateAsync(status, "List updated account products");

            var current = 0;
            var count   = await updatedDataController.CountAsync(listUpdatedStatus);

            var updatedAccountProducts = new Dictionary <long, string>();

            foreach (var updatedId in await updatedDataController.ItemizeAllAsync(listUpdatedStatus))
            {
                await statusController.UpdateProgressAsync(
                    listUpdatedStatus,
                    ++current,
                    count,
                    updatedId.ToString());

                updatedAccountProducts.Add(
                    updatedId,
                    "(Account product not found)");

                var accountProduct = await accountProductsDataController.GetByIdAsync(updatedId, listUpdatedStatus);

                if (accountProduct == null)
                {
                    await statusController.WarnAsync(
                        listUpdatedStatus,
                        "Account product {updatedId} doesn't exist, but is marked as updated");

                    continue;
                }

                updatedAccountProducts[updatedId] = accountProduct.Title;


                // TODO: add updated viewModel formatting controller
                // TODO: figure out how to add and post summaries for the activity like this one using consolePresentationController
            }

            await statusController.CompleteAsync(listUpdatedStatus);
        }
        public async Task <IDictionary <long, IList <string> > > GetDownloadSourcesAsync(IStatus status)
        {
            var getDownloadSourcesStatus = await statusController.CreateAsync(status, "Get download sources");

            var gameDetailsDownloadSources = new Dictionary <long, IList <string> >();
            var current = 0;

            foreach (var id in await updatedDataController.ItemizeAllAsync(getDownloadSourcesStatus))
            {
                await statusController.UpdateProgressAsync(
                    getDownloadSourcesStatus,
                    ++current,
                    await updatedDataController.CountAsync(getDownloadSourcesStatus),
                    id.ToString());

                var gameDetails = await gameDetailsDataController.GetByIdAsync(id, getDownloadSourcesStatus);

                if (!gameDetailsDownloadSources.ContainsKey(id))
                {
                    gameDetailsDownloadSources.Add(id, new List <string>());
                }

                foreach (var manualUrl in
                         await itemizeGameDetailsManualUrlsAsyncController.ItemizeAsync(gameDetails, status))
                {
                    if (!gameDetailsDownloadSources[id].Contains(manualUrl))
                    {
                        gameDetailsDownloadSources[id].Add(manualUrl);
                    }
                }
            }

            await statusController.CompleteAsync(getDownloadSourcesStatus);

            return(gameDetailsDownloadSources);
        }