public static Dictionary <int, string> GetCategoryMap(STRING_CATEGORY category) { Dictionary <int, string> categoryMap = new Dictionary <int, string>(); if (!Singleton <StringTable> .IsValid()) { return(categoryMap); } StringTable i2 = Singleton <StringTable> .I; UIntKeyTable <string> uIntKeyTable = i2.stringKeyTable.Get(category.ToString()); if (uIntKeyTable == null) { return(categoryMap); } string[] values = GetAllInCategory(category); int i = 0; uIntKeyTable.ForEachKey(delegate(uint key) { categoryMap.Add((int)key, values[i]); i++; }); return(categoryMap); }
public static string[] GetAllInCategory(STRING_CATEGORY category) { List <string> texts = new List <string>(); if (!Singleton <StringTable> .IsValid()) { return(texts.ToArray()); } StringTable i = Singleton <StringTable> .I; UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString()); if (uIntKeyTable == null) { return(texts.ToArray()); } uIntKeyTable.ForEach(delegate(string text) { if (string.IsNullOrEmpty(text)) { texts.Add("ERR::STRING_NOT_FOUND"); } else { texts.Add(text); } }); return(texts.ToArray()); }
public static string Format(STRING_CATEGORY category, uint id, params object[] args) { if (!Singleton <StringTable> .IsValid()) { return("ERR::STRING_NOT_FOUND"); } StringTable i = Singleton <StringTable> .I; UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString()); if (uIntKeyTable == null) { return("ERR::STRING_NOT_FOUND"); } string text = uIntKeyTable.Get(id); if (text == null) { return("ERR::STRING_NOT_FOUND"); } if (args == null) { return(text); } return(string.Format(text, args)); }
public static string Get(STRING_CATEGORY category, uint id) { if (!Singleton <StringTable> .IsValid()) { return("ERR::STRING_NOT_FOUND"); } StringTable i = Singleton <StringTable> .I; UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString()); if (uIntKeyTable == null) { return("ERR::STRING_NOT_FOUND"); } string text = uIntKeyTable.Get(id); return((text != null) ? text : "ERR::STRING_NOT_FOUND"); }
public static int[] GetAllKeyInCategory(STRING_CATEGORY category) { List <int> keys = new List <int>(); if (!Singleton <StringTable> .IsValid()) { return(keys.ToArray()); } StringTable i = Singleton <StringTable> .I; UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString()); if (uIntKeyTable == null) { return(keys.ToArray()); } uIntKeyTable.ForEachKey(delegate(uint key) { keys.Add((int)key); }); return(keys.ToArray()); }