public static string Get(UnitSymbolType unitSymbolType, UnitSymbolType onError = UnitSymbolType.UST_NONE) { try { return(LabelUtils.GetLabelFor(unitSymbolType)); } catch (Exception) { try { return(LabelUtils.GetLabelFor(onError)); } catch (Exception) { return(onError.ToString()); } } }
/// <summary> /// Convert a UnitSymbolType enumeration value /// to a brief human readable abbreviation string. /// </summary> public static string UnitSymbolTypeString(UnitSymbolType u) { string s = u.ToString(); Debug.Assert(s.StartsWith("UST_"), "expected UnitSymbolType enumeration value to begin with 'UST_'"); s = s.Substring(4).Replace("_SUP_", "^").ToLower(); return(s); }