private static void CacheNiceStrings() { IEnumerator enumerator = Enum.GetValues(typeof(NetError)).GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; NetError netError = (NetError)((int)current); string str = NetErrorHelper.BuildNiceString(netError); if (str == null && netError != NetError.NoError) { Debug.LogWarning(string.Concat("NetError.", current, " has no nice string")); str = NetErrorHelper.FallbackNiceString(netError); } NetErrorHelper.niceStrings[netError] = str; } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } }
public static string NiceString(this NetError value) { string str; if (NetErrorHelper.niceStrings.TryGetValue(value, out str)) { return(str); } return(NetErrorHelper.FallbackNiceString(value)); }