Ejemplo n.º 1
0
        private async Task PrepareDataBeforeSave(string localPath, bool update)
        {
            HtmlDocument          page = _dataLoader.GetHtmlAsync().Result;
            IEnumerable <Website> uris = _websiteManipulation.GetUrisCategory(page);

            NewModItems.CategoriesMap = AddSchemaCategoryToModsList(uris).ToList();
            List <Task> tasks = new List <Task>();

            foreach (Website uri in uris)
            {
                tasks.Add(PrepareFromFirstSubPage(uri));
            }
            if (update)
            {
                tasks.Add(new Task(async() => { OldModItems.Mods = await GetDataWithFile(localPath); }));
            }
            await Task.WhenAll(tasks);

            if (update)
            {
                CompareFile(ref NewModItems, OldModItems);
            }
        }