public bool NeedUpdate(string grimdawnLocation) { string databaseFile = GrimFolderUtility.FindArzFile(grimdawnLocation); if (!string.IsNullOrEmpty(databaseFile)) { long lastModified = File.GetLastWriteTime(databaseFile).Ticks; if (_databaseSettingDao.GetLastDatabaseUpdate() < lastModified) { Logger.Debug($"A new database parse is required, the file \"{databaseFile}\" has been modified"); return(true); } var expansionLocation = Path.Combine(grimdawnLocation, "gdx1"); if (Directory.Exists(expansionLocation)) { return(NeedUpdate(expansionLocation)); } } else { Logger.WarnFormat("Could not locate database at \"{0}\"", grimdawnLocation); } return(false); }
private void SettingsWindow_Load(object sender, EventArgs e) { this.Dock = DockStyle.Fill; this.labelNumItems.Text = string.Format("Number of items parsed from Grim Dawn database: {0}", _itemDao.GetRowCount()); // TODO: string filename = GrimDawnDetector.GetGrimLocation(); string databaseFile = Path.Combine(filename, "database", "database.arz"); DateTime lastPatch = default(DateTime); if (File.Exists(databaseFile)) { lastPatch = System.IO.File.GetLastWriteTime(databaseFile); this.labelLastPatch.Text = string.Format("Last Grim Dawn patch: {0}", lastPatch.ToString("dd/MM/yyyy")); } else { this.labelLastPatch.Text = "Could not find Grim Dawn install folder"; } DateTime lastUpdate = new DateTime(_settingsDao.GetLastDatabaseUpdate()); this.labelLastUpdated.Text = string.Format("Grim Dawn database last updated: {0}", lastUpdate.ToString("dd/MM/yyyy")); if (lastUpdate < lastPatch) { this.labelLastUpdated.ForeColor = Color.Red; } radioBeta.Checked = (bool)Properties.Settings.Default.SubscribeExperimentalUpdates; radioRelease.Checked = !(bool)Properties.Settings.Default.SubscribeExperimentalUpdates; firefoxCheckBox1.Checked = Properties.Settings.Default.Hotfix1_0_4_0_active; //controller.LoadDefaults(); }
public long GetLastDatabaseUpdate() { return(ThreadExecuter.Execute( () => repo.GetLastDatabaseUpdate() )); }