Exemple #1
0
    public bool AllowRPCCall(uint serviceID, uint methodID)
    {
        if (this.m_data == null)
        {
            return(true);
        }
        RuntimeData runtimedData = this.GetRuntimedData(serviceID, methodID);

        if (runtimedData == null)
        {
            return(true);
        }
        float realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;

        if ((this.m_data.StartupPeriodEnd > 0f) && (realtimeSinceStartup < this.m_data.StartupPeriodEnd))
        {
            float    num2      = this.m_data.StartupPeriodEnd - realtimeSinceStartup;
            object[] objArray1 = new object[] { num2, runtimedData.GetServiceAndMethodNames(), serviceID, methodID };
            this.m_log.LogDebug("Allow (STARTUP PERIOD {0}) {1} ({2}:{3})", objArray1);
            return(true);
        }
        if (runtimedData.AlwaysAllow)
        {
            object[] objArray2 = new object[] { runtimedData.GetServiceAndMethodNames(), serviceID, methodID };
            this.m_log.LogDebug("Allow (ALWAYS ALLOW) {0} ({1}:{2})", objArray2);
            return(true);
        }
        if (runtimedData.AlwaysDeny)
        {
            object[] objArray3 = new object[] { runtimedData.GetServiceAndMethodNames(), serviceID, methodID };
            this.m_log.LogDebug("Deny (ALWAYS DENY) {0} ({1}:{2})", objArray3);
            return(false);
        }
        if (runtimedData.FiniteCallsLeft != uint.MaxValue)
        {
            if (runtimedData.FiniteCallsLeft > 0)
            {
                object[] objArray4 = new object[] { runtimedData.FiniteCallsLeft, runtimedData.GetServiceAndMethodNames(), serviceID, methodID };
                this.m_log.LogDebug("Allow (FINITE CALLS LEFT {0}) {1} ({2}:{3})", objArray4);
                runtimedData.FiniteCallsLeft--;
                return(true);
            }
            object[] objArray5 = new object[] { runtimedData.GetServiceAndMethodNames(), serviceID, methodID };
            this.m_log.LogDebug("Deny (FINITE CALLS LEFT 0) {0} ({1}:{2})", objArray5);
            return(false);
        }
        bool flag = runtimedData.CanCall(realtimeSinceStartup);

        object[] args = new object[] { !flag ? "Deny" : "Allow", runtimedData.GetServiceAndMethodNames(), serviceID, methodID };
        this.m_log.LogDebug("{0} (TRACKER) {1} ({2}:{3})", args);
        return(flag);
    }