using System; using System.Collections.Generic; namespace PKHeX.Core { /// /// String Translation Utility /// public static class RibbonStrings { private static readonly Dictionary RibbonNames = new Dictionary(); /// /// Resets the Ribbon Dictionary to use the supplied set of Ribbon (Property) Names. /// /// Array of strings that are tab separated with Property Name, \t, and Display Name. public static void ResetDictionary(IEnumerable lines) { foreach (var line in lines) { string[] split = line.Split('\t'); if (split.Length != 2) continue; RibbonNames[split[0]] = split[1]; } } /// /// Returns the Ribbon Display Name for the corresponding ribbon property name. /// /// Ribbon property name /// Ribbon display name public static string GetName(string propertyName) { if (!RibbonNames.TryGetValue(propertyName, out string value)) throw new ArgumentException(propertyName); return value; } } }