private static void CreateDataFromServerInformation() { // Populate the manga list from the server information WebData web = new WebData(); IEnumerable<Manga> mangas = web.GetMangas(); // HACK: Disabled for testing, if hitting the real server this will produce more than 20k web calls to get images for all the mangas. // Get additional summary and background images from the server //LocalData.UpdateImageFolderFromServer(backgroundFolder, Constants.DefaultImageName, () => web.GetDefaultBackgroundImages()).Wait(); //LocalData.UpdateImageFolderFromServer(summaryFolder, Constants.DefaultImageName, () => web.GetDefaultSummaryImages()).Wait(); foreach (var manga in mangas) { CreateSummaryImageFromRemoteUrl(manga); // TODO: this is not necessary once we have GetSummaryImages working in the server //LocalData.UpdateImageFolderFromServer(backgroundFolder, manga.Title, () => web.GetBackgroundImages(manga)).Wait(); //LocalData.UpdateImageFolderFromServer(summaryFolder, manga.Title, () => web.GetSummaryImages(manga)).Wait(); } // Add mangas to the database using (SQLiteConnection db = new SQLiteConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, Constants.DbName))) { db.CreateTable<LocalDataVersion>(); db.CreateTable<Manga>(); db.CreateTable<Provider>(); db.Insert(new LocalDataVersion(web.MangaListVersion)); db.InsertAll(mangas); } }
/// <summary> /// Initializes a new instance of the <see cref="LocalData" /> class. /// </summary> public LocalData() { this.webData = new WebData(); }