예제 #1
0
        private void buttonSelect_Click(object sender, EventArgs e)
        {
            // find selected checkbox
            // if selected != Properties.Settings.Default.LocalizationFile
            var cb = Checkboxes.Where(m => m.Checked).FirstOrDefault();

            if (cb != null)
            {
                var package = cb.Tag.ToString();
                if (package != Properties.Settings.Default.LocalizationFile)
                {
                    Properties.Settings.Default.LocalizationFile = package;
                    Properties.Settings.Default.Save();

                    if (!string.IsNullOrEmpty(Properties.Settings.Default.LocalizationFile))
                    {
                        var loader = new LocalizationLoader();
                        GlobalSettings.Language = loader.LoadLanguage(package);

                        // TODO: Grab tags from loader and save to sql
                        databaseItemDao.Save(loader.GetItemTags());

                        UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(playerItemDao);
                        x.ShowDialog();
                    }
                    // Load the GD one
                    else
                    {
                        // Override timestamp to force an update
                        GlobalSettings.Language = new EnglishLanguage();

                        string location = GrimDawnDetector.GetGrimLocation();
                        if (!string.IsNullOrEmpty(location) && Directory.Exists(location))
                        {
                            ParsingDatabaseScreen parserUi = new ParsingDatabaseScreen(databaseSettingDao, this.parser, location, string.Empty, true, true);
                            parserUi.ShowDialog();
                        }
                        else
                        {
                            logger.Warn("Could not find the Grim Dawn install location");
                        }

                        // Update item stats as well
                        UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(playerItemDao);
                        x.ShowDialog();
                    }
                }
            }
            this.Close();
        }
예제 #2
0
        /// <summary>
        /// Sets the "last database update" timestamp to 0 to force an update
        /// Queues a database update, followed by an item stat update.
        /// </summary>
        public void ForceDatabaseUpdate(string location, bool isVanilla)
        {
            // Override timestamp to force an update
            _databaseSettingDao.UpdateDatabaseTimestamp(0);

            var paths = GrimDawnDetector.GetGrimLocations();

            if (!string.IsNullOrEmpty(location) && Directory.Exists(location) && _arzParser.NeedUpdate(location))
            {
                ParsingDatabaseScreen parser = new ParsingDatabaseScreen(
                    _databaseSettingDao,
                    _arzParser,
                    location,
                    Properties.Settings.Default.LocalizationFile,
                    false,
                    !isVanilla);
                parser.ShowDialog();

                //databaseSettingDao.UpdateCurrentDatabase(location);
                UpdateListview(paths);
            }
            else
            {
                Logger.Warn("Could not find the Grim Dawn install location");
            }

            // Update item stats as well
            UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(_playerItemDao);

            x.ShowDialog();


            if (_itemViewUpdateTrigger != null)
            {
                _itemViewUpdateTrigger();
            }
        }