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

            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, new EnglishLanguage(new Dictionary <string, string>()));

                        // TODO: Grab tags from loader and save to sql
                        _itemTagDao.Save(loader.GetItemTags(), new ProgressTracker());

                        UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(_playerItemDao);
                        x.ShowDialog();
                    }
                    // Load the GD one
                    else
                    {
                        // Override timestamp to force an update
                        GlobalSettings.InitializeLanguage(string.Empty, new Dictionary <string, string>()); // TODO: Not ideal, will need a restart

                        foreach (var location in _paths)
                        {
                            if (!string.IsNullOrEmpty(location) && Directory.Exists(location))
                            {
                                _parsingService.Update(location, string.Empty);
                                _parsingService.Execute();
                                break;
                            }
                            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
        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();
        }