public void CheckForSync() // called in background init { if (!EDDOptions.Instance.NoSystemsLoad && EDDConfig.Instance.EDSMEDDBDownload) // if enabled { DateTime edsmdatetime = SQLiteConnectionSystem.GetLastEDSMRecordTimeUTC(); if (DateTime.UtcNow.Subtract(edsmdatetime).TotalDays >= 28) // 600k ish per 12hours. So 33MB. Much less than a full download which is (23/1/2018) 2400MB, or 600MB compressed { System.Diagnostics.Debug.WriteLine("EDSM full sync ordered, time since {0}", DateTime.UtcNow.Subtract(edsmdatetime).TotalDays); syncstate.perform_edsm_fullsync = true; // do a full sync. } DateTime eddbdatetime = SQLiteConnectionSystem.GetLastEDDBDownloadTime(); if (DateTime.UtcNow.Subtract(eddbdatetime).TotalDays > 6.5) // Get EDDB data once every week. { syncstate.perform_eddb_edsmalias_sync = true; } if (syncstate.perform_eddb_edsmalias_sync || syncstate.perform_edsm_fullsync) { string databases = (syncstate.perform_edsm_fullsync && syncstate.perform_eddb_edsmalias_sync) ? "EDSM and EDDB" : ((syncstate.perform_edsm_fullsync) ? "EDSM" : "EDDB"); LogLine(string.Format("Full synchronisation to the {0} databases required." + Environment.NewLine + "This will take a while, please be patient." + Environment.NewLine + "Please continue running ED Discovery until refresh is complete.".T(EDTx.EDDiscoveryController_SyncEDSM), databases)); } } else { LogLine("Synchronisation to EDSM and EDDB disabled. Use Settings panel to reenable".T(EDTx.EDDiscoveryController_SyncOff)); } }