Exemplo n.º 1
0
 public StringTableEntry(StringCategory category, string key, string fallback, string speaker = null)
 {
     Category = category;
     Key      = key;
     Fallback = fallback;
     Speaker  = speaker;
     Text     = Array.Empty <string>();
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
        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]++);
        }
Exemplo n.º 5
0
 internal StringTableEntry(StringCategory category, string key)
 {
     Category = category;
     Key      = key;
 }