private void CheckSystems(Func <bool> cancelRequested, Action <int, string> reportProgress) // ASYNC process, done via start up, must not be too slow. { reportProgress(-1, ""); string rwsystime = SQLiteConnectionSystem.GetSettingString("EDSMLastSystems", "2000-01-01 00:00:00"); // Latest time from RW file. DateTime edsmdate; if (!DateTime.TryParse(rwsystime, CultureInfo.InvariantCulture, DateTimeStyles.None, out edsmdate)) { edsmdate = new DateTime(2000, 1, 1); } if (DateTime.Now.Subtract(edsmdate).TotalDays > 7) // Over 7 days do a sync from EDSM { // Also update galactic mapping from EDSM LogLine("Get galactic mapping from EDSM."); galacticMapping.DownloadFromEDSM(); // Skip EDSM full update if update has been performed in last 4 days bool outoforder = SQLiteConnectionSystem.GetSettingBool("EDSMSystemsOutOfOrder", true); DateTime lastmod = outoforder ? SystemClass.GetLastSystemModifiedTime() : SystemClass.GetLastSystemModifiedTimeFast(); if (DateTime.UtcNow.Subtract(lastmod).TotalDays > 4 || DateTime.UtcNow.Subtract(edsmdate).TotalDays > 28) { syncstate.performedsmsync = true; } else { SQLiteConnectionSystem.PutSettingString("EDSMLastSystems", DateTime.Now.ToString(CultureInfo.InvariantCulture)); } } if (!cancelRequested()) { SQLiteConnectionUser.TranferVisitedSystemstoJournalTableIfRequired(); SQLiteConnectionSystem.CreateSystemsTableIndexes(); SystemNoteClass.GetAllSystemNotes(); // fill up memory with notes, bookmarks, galactic mapping BookmarkClass.GetAllBookmarks(); galacticMapping.ParseData(); // at this point, EDSM data is loaded.. SystemClass.AddToAutoComplete(galacticMapping.GetGMONames()); EDDiscovery.EliteDangerous.MaterialCommodityDB.SetUpInitialTable(); LogLine("Loaded Notes, Bookmarks and Galactic mapping."); string timestr = SQLiteConnectionSystem.GetSettingString("EDDBSystemsTime", "0"); DateTime time = new DateTime(Convert.ToInt64(timestr), DateTimeKind.Utc); if (DateTime.UtcNow.Subtract(time).TotalDays > 6.5) // Get EDDB data once every week. { syncstate.performeddbsync = true; } } }