private void buttonForceUpdate_Click(object sender, EventArgs e) { _databaseItemDao.Clean(); var mod = GetFirst(listViewMods); var entry = GetFirst(listViewInstalls); if (mod != null) { // Load selected mod icons ThreadPool.QueueUserWorkItem((m) => ArzParser.LoadSelectedModIcons(mod.Path)); } ForceDatabaseUpdate(entry.Path, mod?.Path); _settingsService.GetLocal().CurrentGrimdawnLocation = entry.Path; // Store the loaded GD path, so we can poll it for updates later. //_settingsService.GetLocal().GrimDawnLocation = new List<string> { entry.Path }; // TODO: Wtf is this? Why overwrite any existing? _settingsService.GetLocal().GrimDawnLocationLastModified = ParsingService.GetHighestTimestamp(entry.Path); _settingsService.GetLocal().HasWarnedGrimDawnUpdate = false; var isGdParsed = _databaseItemDao.GetRowCount() > 0; _settingsService.GetLocal().IsGrimDawnParsed = isGdParsed; _helpService.SetIsGrimParsed(isGdParsed); }
private void ThreadStart() { ExceptionReporter.EnableLogUnhandledOnThread(); t.Name = "ItemStatCache"; t.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); // Sleeping a bit in the start, we don't wanna keep locking the DB (SQLite mode) on startup try { Thread.Sleep(1000 * 15); } catch (ThreadInterruptedException) { // Don't care } while (t?.IsAlive ?? false) { // Only perform action if we got plenty in the DB, otherwise we might not be parsed yet. bool result = false; if (_databaseItemDao.GetRowCount() > 20000) { result = Tick(); } try { Thread.Sleep(result ? 1500 : 120 * 1000); } catch (ThreadInterruptedException) { // Don't care } } }
public long GetRowCount() { return(ThreadExecuter.Execute( () => _repo.GetRowCount() )); }
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(); }