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(); }
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(); }
public void LoadTags( List <string> tagfiles, string localizationFile, ProgressTracker tracker ) { int numFiles = tagfiles.Count - tagfiles.Where(string.IsNullOrEmpty).Count() + (string.IsNullOrEmpty(localizationFile) ? 0 : 1); tracker.MaxValue = numFiles; // Load tags in a prioritized order foreach (var tagfile in tagfiles) { if (File.Exists(tagfile)) { Logger.Debug($"Loading tags from {tagfile}"); LoadTags(tagfile); } else { Logger.Debug($"Ignoring non-existing tagfile {tagfile}"); } tracker.Increment(); } // User override for some tags var localizationLoader = new LocalizationLoader(); if (!string.IsNullOrEmpty(localizationFile) && localizationLoader.Load(localizationFile)) { Logger.Debug($"Loading tags from {localizationFile}"); var tags = localizationLoader.GetItemTags(); foreach (var tag in tags) { _tagAccumulator.Add(tag.Tag, tag.Name); } Logger.Debug($"Loaded {tags.Count} tags from {localizationFile}"); tracker.Increment(); } tracker.MaxProgress(); }
public void LoadTags( string tagfileVanilla, string tagfileExpansion1, string tagfileMod, string localizationFile, ProgressTracker tracker ) { var files = new[] { tagfileVanilla, tagfileExpansion1, tagfileMod }; int numFiles = files.Length - files.Where(string.IsNullOrEmpty).Count() + (string.IsNullOrEmpty(localizationFile) ? 0 : 1); tracker.MaxValue = numFiles; // Load tags in a prioritized order foreach (var tagfile in files) { if (File.Exists(tagfile)) { LoadTags(tagfile); } tracker.Increment(); } // User override for some tags var localizationLoader = new LocalizationLoader(); if (!string.IsNullOrEmpty(localizationFile) && localizationLoader.Load(localizationFile)) { Logger.Debug($"Loading tags from {localizationFile}"); var tags = localizationLoader.GetItemTags(); foreach (var tag in tags) { _tagAccumulator.Add(tag.Tag, tag.Name); } Logger.Debug($"Loaded {tags.Count} tags from {localizationFile}"); tracker.Increment(); } tracker.MaxProgress(); }