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(); }