Exemplo n.º 1
0
    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();
        }
    }
Exemplo n.º 2
0
    public static string NiceString(this NetError value)
    {
        string str;

        if (NetErrorHelper.niceStrings.TryGetValue(value, out str))
        {
            return(str);
        }
        return(NetErrorHelper.FallbackNiceString(value));
    }