public void Set(string key, string value) { StringTableManager.StringCollection stringCollection = new StringTableManager.SimpleStringCollection(); stringCollection.AddString(value, 1f); bool flag = this.Table.ContainsKey(key); if (flag) { this.Table[key] = stringCollection; } else { this.Table.Add(key, stringCollection); } int num = this._ChangeKeys.IndexOf(key); bool flag2 = num > 0; if (flag2) { this._ChangeValues[num] = stringCollection; } else { this._ChangeKeys.Add(key); this._ChangeValues.Add(stringCollection); } JournalEntry.ReloadDataSemaphore++; }
private static void _AddString(Dictionary <string, StringTableManager.StringCollection> dict, string key, string value) { if (!key.StartsWithInvariant("#")) { key = $"#{key}"; } var coll = dict[key] = new StringTableManager.SimpleStringCollection(); coll.AddString(value, 1f); }
/// <summary> /// Adds a new string to this translation and if the current language is equal to <see cref="language"/> of this translation, applies the change. /// </summary> /// <param name="key">The key to string.</param> /// <param name="value">The translated string.</param> public void AddStringTranslation(string key, string value) { StringTableManager.SimpleStringCollection collection = new StringTableManager.SimpleStringCollection(); collection.AddString(value, 1f); strings[key] = collection; if (StringTableManager.CurrentLanguage == language) { Table[key] = collection; JournalEntry.ReloadDataSemaphore++; } }
public static void AddStringDefinition(string key, string value) { foreach (string field in fields) { FieldInfo fi = typeof(StringTableManager).GetField(field, BindingFlags.NonPublic | BindingFlags.Static); var dictionary = (Dictionary <string, StringTableManager.StringCollection>)fi.GetValue(null); if (dictionary == null) { continue; } var collection = new StringTableManager.SimpleStringCollection(); collection.AddString(value, 1); if (!dictionary.ContainsKey(key)) { dictionary.Add(key, collection); } } }
/// <summary> /// Sets a string with the key of <paramref name="key"/> in the table. /// </summary> /// <param name="key">The string's key.</param> /// <param name="value">The string value.</param> public void Set(string key, string value) { StringTableManager.SimpleStringCollection simpleStringCollection = new StringTableManager.SimpleStringCollection(); simpleStringCollection.AddString(value, 1f); SetValue(key, simpleStringCollection); }
public void Set(string key, string value) { StringTableManager.StringCollection value_ = new StringTableManager.SimpleStringCollection(); value_.AddString(value, 1f); this[key] = value_; }