示例#1
0
        static GameLoginWatch()
        {
            try
            {
                GameLogin_Games = ConfigHelper.GetSetting("GameLogin_Games");
                GameLogin_Id = ConfigHelper.GetSetting("GameLogin_Id");
                GameLogin_pwd = ConfigHelper.GetConnectionString("GameLogin_pwd");
                GameLogin_pwd = new ZyGames.DesSecurity.DESAlgorithmNew().EncodePwd(GameLogin_pwd, "n7=7=7dk");
                GameLogin_pwd = HttpUtility.UrlEncode(GameLogin_pwd, Encoding.UTF8);
            }
            catch (Exception ex)
            {
                Logger.SaveLog("The login check configuration error", ex);
            }

            string[] gameArry = GameLogin_Games.Split(',');
            foreach (var item in gameArry)
            {
                if (string.IsNullOrEmpty(item)) continue;
                var itemArray = item.Split('=');
                if (itemArray.Length != 2) continue;
                int gameId = Convert.ToInt32(itemArray[0]);
                string gameName = itemArray[1];
                if (!gameDict.ContainsKey(gameId))
                {
                    gameDict.Add(gameId, gameName);
                }
            }
        }
示例#2
0
        private static string GetRequestParams(string sid, string uid, string contractId, int slnId, string pid, string pwd, string paramList)
        {
            string[] paramArray = null;
            if (paramList != null)
            {
                paramArray = paramList.Split(new char[] { ',', ',', ' ', ';' });
            }

            StringBuilder requestParams = new StringBuilder();

            requestParams.AppendFormat("Sid={0}&Uid={1}&ActionID={2}", sid, uid, contractId);

            DataSet           reqParamList = new ParamInfoBLL().GetList(string.Format("ContractID={0} and SlnID={1} and ParamType=1", contractId, slnId));
            DataRowCollection paramRecords = reqParamList.Tables[0].Rows;

            int i = 0;

            foreach (DataRow record in paramRecords)
            {
                if (requestParams.Length > 0)
                {
                    requestParams.Append("&");
                }
                string fieldName  = record["Field"].ToString();
                string fieldValue = record["FieldValue"].ToString();

                if (contractId == "1004")
                {
                    if (fieldName.ToLower().Equals("pid"))
                    {
                        fieldValue = string.IsNullOrEmpty(pid)
                                         ? fieldValue
                                         : pid;
                    }
                    else if (fieldName.ToLower().Equals("pwd"))
                    {
                        fieldValue = string.IsNullOrEmpty(pwd)
                                         ? fieldValue
                                         : pwd;
                        fieldValue = new ZyGames.DesSecurity.DESAlgorithmNew().EncodePwd(fieldValue, "n7=7=7dk");
                        fieldValue = HttpUtility.UrlEncode(fieldValue, Encoding.UTF8);
                    }
                }
                else
                {
                    if (paramArray != null && i < paramArray.Length && !string.IsNullOrEmpty(paramArray[i]))
                    {
                        fieldValue = paramArray[i];
                    }
                }
                requestParams.AppendFormat("{0}={1}", fieldName, fieldValue);
                i++;
            }
            return(requestParams.ToString());
        }
示例#3
0
        private static string GetRequestParams(string sid, string uid, string contractId, int slnId, string pid, string pwd, string paramList)
        {
            string[] paramArray = null;
            if (paramList != null)
            {
                paramArray = paramList.Split(new char[] { ',', ',', ' ', ';' });
            }

            StringBuilder requestParams = new StringBuilder();
            requestParams.AppendFormat("Sid={0}&Uid={1}&ActionID={2}", sid, uid, contractId);

            DataSet reqParamList = new ParamInfoBLL().GetList(string.Format("ContractID={0} and SlnID={1} and ParamType=1", contractId, slnId));
            DataRowCollection paramRecords = reqParamList.Tables[0].Rows;

            int i = 0;
            foreach (DataRow record in paramRecords)
            {
                if (requestParams.Length > 0)
                {
                    requestParams.Append("&");
                }
                string fieldName = record["Field"].ToString();
                string fieldValue = record["FieldValue"].ToString();

                if (contractId == "1004")
                {
                    if (fieldName.ToLower().Equals("pid"))
                    {
                        fieldValue = string.IsNullOrEmpty(pid)
                                         ? fieldValue
                                         : pid;
                    }
                    else if (fieldName.ToLower().Equals("pwd"))
                    {
                        fieldValue = string.IsNullOrEmpty(pwd)
                                         ? fieldValue
                                         : pwd;
                        fieldValue = new ZyGames.DesSecurity.DESAlgorithmNew().EncodePwd(fieldValue, "n7=7=7dk");
                        fieldValue = HttpUtility.UrlEncode(fieldValue, Encoding.UTF8);
                    }
                }
                else
                {
                    if (paramArray != null && i < paramArray.Length && !string.IsNullOrEmpty(paramArray[i]))
                    {
                        fieldValue = paramArray[i];
                    }
                }
                requestParams.AppendFormat("{0}={1}", fieldName, fieldValue);
                i++;
            }
            return requestParams.ToString();
        }