public StringTableEntry(StringCategory category, string key, string fallback, string speaker = null) { Category = category; Key = key; Fallback = fallback; Speaker = speaker; Text = Array.Empty <string>(); }
public void ExternalizeStringLiteral(StringLiteral literal, StringCategory category, bool includeSpeaker = false) { string key = GetUniqueId(category, literal.Value); StringTable[key] = new StringTableEntry(category, key, literal.Value, includeSpeaker ? _currentSpeaker : null); literal.StringTable = StringTable; literal.ExternalKey = key; }
public static bool ProcessingStringForUILabel(ref string text) { if (!string.IsNullOrEmpty(text) && text[0] == '{' && text[text.Length - 1] == '}') { int num = text.IndexOf(','); if (num != -1) { string str = text.Substring(1, num - 1); string s = text.Substring(num + 1, text.Length - num - 2); text = StringTable.Get(StringCategory.FromString(str), uint.Parse(s)); return(true); } } return(false); }
public string GetUniqueId(StringCategory category, string value) { if (category == StringCategory.N) { string key = StringTable.Names.FirstOrDefault(entry => entry.Fallback == value)?.Key; if (key != null) { return(key); } } if (!IdCounter.ContainsKey(category)) { IdCounter[category] = 1; } return(category.ToString() + IdCounter[category]++); }
internal StringTableEntry(StringCategory category, string key) { Category = category; Key = key; }