private void LoadGameStrings() { stringsManager.Load(comboBoxLanguage.SelectedItem.ToString(), Path.GetDirectoryName(_configuration.ExecutablePath)); foreach (var line in stringsManager.Lines) { strings.Add(new List <string> { line.Value[0].str_id.ToString(), "0", line.Value[0].str }); } FillListView(strings); toolStripStatusLabelStringsCount.Text = "Strings Loaded: " + strings.Count; if (guiStrings.Count == 0) { return; } var matchedStringsCounter = 0; foreach (ListViewItem item in listViewStrings.Items) { if (guiStrings.Contains(item.Text)) { item.ForeColor = Color.Blue; ++matchedStringsCounter; } if (matchedStringsCounter == guiStrings.Count) { return; } } }
public static W3StringManager LoadStringsManager() { var _settings = ServiceLocator.Default.ResolveType <ISettingsManager>(); var _logger = ServiceLocator.Default.ResolveType <ILoggerService>(); _logger.LogString("Loading Strings Manager ... ", Logtype.Important); try { if (File.Exists(Tw3Controller.GetManagerPath(EManagerType.W3StringManager)) && new FileInfo(Tw3Controller.GetManagerPath(EManagerType.W3StringManager)).Length > 0) { using (var file = File.Open(Tw3Controller.GetManagerPath(EManagerType.W3StringManager), FileMode.Open)) { w3StringManager = Serializer.Deserialize <W3StringManager>(file); } } else { w3StringManager = new W3StringManager(); w3StringManager.Load(_settings.TextLanguage, Path.GetDirectoryName(_settings.ExecutablePath)); Directory.CreateDirectory(Tw3Controller.ManagerCacheDir); using (var file = File.Open(Tw3Controller.GetManagerPath(EManagerType.W3StringManager), FileMode.Create)) { Serializer.Serialize(file, w3StringManager); } _settings.ManagerVersions[(int)EManagerType.W3StringManager] = W3StringManager.SerializationVersion; } } catch (System.Exception) { if (File.Exists(Tw3Controller.GetManagerPath(EManagerType.W3StringManager))) { File.Delete(Tw3Controller.GetManagerPath(EManagerType.W3StringManager)); } w3StringManager = new W3StringManager(); w3StringManager.Load(_settings.TextLanguage, Path.GetDirectoryName(_settings.ExecutablePath)); } _logger.LogString("Finished loading Strings Manager.", Logtype.Success); return(w3StringManager); }
public void ReloadStringManager() { W3StringManager.Load(Configuration.TextLanguage, Path.GetDirectoryName(Configuration.ExecutablePath), true); }