コード例 #1
0
        public static string OrderReturnStatusText(int status)
        {
            string sText = "-";

            switch (status)
            {
            case -2:
            {
                sText = Protect.ToString(Resources.Vietcon.STATUS_ORDER_RETURN_m2);
                break;
            }

            case 0:
            {
                sText = Protect.ToString(Resources.Vietcon.STATUS_ORDER_RETURN_0);
                break;
            }

            case 1:
            {
                sText = Protect.ToString(Resources.Vietcon.STATUS_ORDER_RETURN_1);
                break;
            }

            case 2:
            {
                sText = Protect.ToString(Resources.Vietcon.STATUS_ORDER_RETURN_2);
                break;
            }
            }
            return(sText);
        }
コード例 #2
0
        protected virtual bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }

            string controller = Protect.ToString(httpContext.Request.RequestContext.RouteData.Values["controller"]).Trim();
            string action     = Protect.ToString(httpContext.Request.RequestContext.RouteData.Values["action"]).Trim();
            // check LoginSessionKey
            var loginSessionKey = AccountUtils.CurrentSessionKey();
            var res             = AccountDA.CheckSession(AccountUtils.CurrentSessionKey());

            // invalid session
            if (res != null && res.ResponseCode == 0)
            {
                Sessions.AddMessage("SessionExpired", "Hết hạn lượt truy cập.");
                return(false);
            }

            return(true);
        }
コード例 #3
0
        public List <CPluginVariable> GetDisplayPluginVariables()
        {
            var list = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Commands + VariableName.PunishCommand, typeof(string[]), _punishCommand),
                new CPluginVariable(VariableGroup.Commands + VariableName.ForgiveCommand, typeof(string[]), _forgiveCommand),
                new CPluginVariable(VariableGroup.Commands + VariableName.AllowKillersToApologizeToAvoidPunishment, typeof(enumBoolYesNo), _allowKillersToApologizeToAvoidPunishment),
                new CPluginVariable(VariableGroup.Commands + VariableName.ShameCommand, typeof(string[]), _shameCommand),
                new CPluginVariable(VariableGroup.Messages + VariableName.KillerMessages, typeof(string[]), _killerMessages),
                new CPluginVariable(VariableGroup.Messages + VariableName.VictimMessages, typeof(string[]), _victimMessages),
                new CPluginVariable(VariableGroup.Messages + VariableName.PunishedMessage, typeof(string), _punishedMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.ForgivenMessage, typeof(string), _forgivenMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.ApologizedMessage, typeof(string), _apologizedMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.KickMessage, typeof(string), _kickMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToPunishMessage, typeof(string), _noOneToPunishMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToForgiveMessage, typeof(string), _noOneToForgiveMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToApologizeToMessage, typeof(string), _noOneToApologizeToMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.ShameAllOnRoundEnd, typeof(enumBoolYesNo), _shameAllOnRoundEnd),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToShameMessage, typeof(string), _noOneToShameMessage),
                new CPluginVariable(VariableGroup.Limits + VariableName.VictimWindow, typeof(int), _victimWindow.TotalSeconds),
                new CPluginVariable(VariableGroup.Limits + VariableName.AutoAction, CreateEnumString(typeof(Action)), _autoAction.ToString()),
                new CPluginVariable(VariableGroup.Limits + VariableName.HasPunishLimit, CreateEnumString(typeof(enumBoolYesNo)), _hasPunishLimit.ToString()),
                new CPluginVariable(VariableGroup.Protection + VariableName.Protected, CreateEnumString(typeof(Protect)), _protect.ToString()),
                new CPluginVariable(VariableGroup.Debug + VariableName.ShouldSuicideCountAsATeamKill, typeof(enumBoolYesNo), _shouldSuicideCountAsATeamKill),
                new CPluginVariable(VariableGroup.Debug + VariableName.OutputToChat, CreateEnumString(typeof(Chat)), _outputToChat.ToString()),
                new CPluginVariable(VariableGroup.Protection + VariableName.UseAdKats, typeof(enumBoolYesNo), _useAdKats),
            };

            // Sorry

            var insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.AllowKillersToApologizeToAvoidPunishment)) + 1;

            var sorry = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Commands + VariableName.SorryCommand, typeof(string[]), _sorryCommand)
            };

            if (_allowKillersToApologizeToAvoidPunishment == enumBoolYesNo.Yes)
            {
                list.InsertRange(insertAt, sorry);
            }

            // Shame

            insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.ShameAllOnRoundEnd)) + 1;

            var shame = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToShameOnRoundEndMessage, typeof(string), _noOneToShameOnRoundEndMessage)
            };

            if (_shameAllOnRoundEnd == enumBoolYesNo.Yes)
            {
                list.InsertRange(insertAt, shame);
            }

            // Limits

            insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.HasPunishLimit)) + 1;

            var limits = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Limits + VariableName.PunishLimit, typeof(int), _punishLimit),
                new CPluginVariable(VariableGroup.Limits + VariableName.PlayerCountThresholdForKick, typeof(int), _playerCountThresholdForKick)
            };

            if (_hasPunishLimit == enumBoolYesNo.Yes)
            {
                list.InsertRange(insertAt, limits);
            }

            // Protection

            insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.Protected)) + 1;

            var whitelist = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Protection + VariableName.Whitelist, typeof(string[]), _whitelist)
            };

            if (_protect == Protect.Whitelist || _protect == Protect.AdminsAndWhitelist)
            {
                list.InsertRange(insertAt, whitelist);
            }

            return(list);
        }