Exemple #1
0
        private static void SimpleCaptureWithRef()
        {
            _003C_003Ec__DisplayClass2_0 _003C_003Ec__DisplayClass2_ = new _003C_003Ec__DisplayClass2_0();

            _003C_003Ec__DisplayClass2_.x = 1;
#if OPT
            new Handle(new Func <int>(_003C_003Ec__DisplayClass2_._003CSimpleCaptureWithRef_003Eg__F_007C0));
#else
            Handle handle = new Handle(new Func <int>(_003C_003Ec__DisplayClass2_._003CSimpleCaptureWithRef_003Eg__F_007C0));
#endif
        }
    private static bool CheckIfPlayerBanned(ulong steamId, Connection connection, UnityWebRequest request)
    {
        _003C_003Ec__DisplayClass2_0 _003C_003Ec__DisplayClass2_ = default(_003C_003Ec__DisplayClass2_0);

        _003C_003Ec__DisplayClass2_.connection = connection;
        if (request.isNetworkError)
        {
            Debug.LogError("Failed to check centralized bans due to a network error (" + request.error + ")");
            if (ConVar.Server.bansServerFailureMode == 1)
            {
                _003CCheckIfPlayerBanned_003Eg__Reject_007C2_0("Centralized Ban Error: Network Error", ref _003C_003Ec__DisplayClass2_);
                return(true);
            }
            return(false);
        }
        if (request.responseCode == 404)
        {
            return(false);
        }
        if (request.isHttpError)
        {
            Debug.LogError($"Failed to check centralized bans due to a server error ({request.responseCode}: {request.error})");
            if (ConVar.Server.bansServerFailureMode == 1)
            {
                _003CCheckIfPlayerBanned_003Eg__Reject_007C2_0("Centralized Ban Error: Server Error", ref _003C_003Ec__DisplayClass2_);
                return(true);
            }
            return(false);
        }
        try
        {
            payloadData.steamId    = 0uL;
            payloadData.reason     = null;
            payloadData.expiryDate = 0L;
            JsonUtility.FromJsonOverwrite(request.downloadHandler.text, payloadData);
            if (payloadData.expiryDate > 0 && Epoch.Current >= payloadData.expiryDate)
            {
                return(false);
            }
            if (payloadData.steamId != steamId)
            {
                Debug.LogError($"Failed to check centralized bans due to SteamID mismatch (expected {steamId}, got {payloadData.steamId})");
                if (ConVar.Server.bansServerFailureMode == 1)
                {
                    _003CCheckIfPlayerBanned_003Eg__Reject_007C2_0("Centralized Ban Error: SteamID Mismatch", ref _003C_003Ec__DisplayClass2_);
                    return(true);
                }
                return(false);
            }
            string text  = payloadData.reason ?? "no reason given";
            string text2 = ((payloadData.expiryDate > 0) ? (" for " + (payloadData.expiryDate - Epoch.Current).FormatSecondsLong()) : "");
            _003CCheckIfPlayerBanned_003Eg__Reject_007C2_0("You are banned from this server" + text2 + " (" + text + ")", ref _003C_003Ec__DisplayClass2_);
            return(true);
        }
        catch (Exception exception)
        {
            Debug.LogError("Failed to check centralized bans due to a malformed response: " + request.downloadHandler.text);
            Debug.LogException(exception);
            if (ConVar.Server.bansServerFailureMode == 1)
            {
                _003CCheckIfPlayerBanned_003Eg__Reject_007C2_0("Centralized Ban Error: Malformed Response", ref _003C_003Ec__DisplayClass2_);
                return(true);
            }
            return(false);
        }
    }