コード例 #1
0
ファイル: NetErrorHelper.cs プロジェクト: sknchan/LegacyRust
    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();
        }
    }
コード例 #2
0
ファイル: NetErrorHelper.cs プロジェクト: sknchan/LegacyRust
    public static string NiceString(this NetError value)
    {
        string str;

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