예제 #1
0
        /// <summary>
        /// 获得网关的参数值。没有参数值时返回空字符串,Get方式的值均为未解码。
        /// </summary>
        /// <param name="gatewayParameterName">网关的参数名称</param>
        /// <param name="gatewayParameterRequestMethod">网关的数据的请求方法的类型</param>
        public string GetGatewayParameterValue(string gatewayParameterName, GatewayParameterRequestMethod gatewayParameterRequestMethod)
        {
            GatewayParameter parameter = GatewayParameterData.SingleOrDefault(p => string.Compare(p.Name, gatewayParameterName) == 0 &&
                                                                              (p.RequestMethod & gatewayParameterRequestMethod) == p.RequestMethod);

            if (parameter != null)
            {
                return(parameter.Value);
            }

            return(string.Empty);
        }
예제 #2
0
        /// <summary>
        /// 设置网关的数据
        /// </summary>
        /// <param name="gatewayParameterList">保存网关参数的集合</param>
        /// <param name="gatewayParameterName">网关的参数名称</param>
        /// <param name="gatewayParameterValue">网关的参数值</param>
        /// <param name="gatewayParameterRequestMethod">网关的参数的请求方式的类型</param>
        private static void SetGatewayParameterValue(List <GatewayParameter> gatewayParameterList, string gatewayParameterName,
                                                     string gatewayParameterValue, GatewayParameterRequestMethod gatewayParameterRequestMethod)
        {
            GatewayParameter existsParam = gatewayParameterList.SingleOrDefault(p => string.Compare(p.Name, gatewayParameterName) == 0);

            if (existsParam == null)
            {
                GatewayParameter param = new GatewayParameter(gatewayParameterName, gatewayParameterValue, gatewayParameterRequestMethod);
                gatewayParameterList.Add(param);
            }
            else
            {
                if (string.Compare(existsParam.Value, gatewayParameterValue) == 0)
                {
                    existsParam.RequestMethod = existsParam.RequestMethod | gatewayParameterRequestMethod;
                }
                else
                {
                    existsParam.RequestMethod = gatewayParameterRequestMethod;
                    existsParam.Value         = gatewayParameterValue;
                }
            }
        }
예제 #3
0
 /// <summary>
 /// 获得网关的参数值。没有参数值时返回空字符串,Get方式的值均为未解码。
 /// </summary>
 /// <param name="gatewayParameterName">网关的参数名称</param>
 /// <param name="gatewayParameterRequestMethod">网关的数据的请求方法的类型</param>
 public string GetGatewayParameterValue(string gatewayParameterName, GatewayParameterRequestMethod gatewayParameterRequestMethod)
 {
     return(gateway.GetGatewayParameterValue(gatewayParameterName, gatewayParameterRequestMethod));
 }
예제 #4
0
 public GatewayParameter(string parameterName, string parameterValue, GatewayParameterRequestMethod parameterType)
 {
     this.name     = parameterName;
     Value         = parameterValue;
     RequestMethod = parameterType;
 }
예제 #5
0
 /// <summary>
 /// �������ص�����
 /// </summary>
 /// <param name="gatewayParameterName">���صIJ�������</param>
 /// <param name="gatewayParameterValue">���صIJ���ֵ</param>
 /// <param name="gatewayParameterRequestMethod">���صIJ��������󷽷�������</param>
 /// <remarks>
 /// �����õIJ�������ʱ�����������ֵ��һ�����޸�Ϊ�µIJ���ֵ��
 /// </remarks>
 public void SetGatewayParameterValue(string gatewayParameterName, string gatewayParameterValue, GatewayParameterRequestMethod gatewayParameterRequestMethod)
 {
     GatewayParameter existsParam = GatewayParameterData.SingleOrDefault(p => string.Compare(p.Name, gatewayParameterName) == 0);
     if (existsParam == null)
     {
         GatewayParameter param = new GatewayParameter(gatewayParameterName, gatewayParameterValue, gatewayParameterRequestMethod);
         GatewayParameterData.Add(param);
     }
     else
     {
         if (string.Compare(existsParam.Value, gatewayParameterValue) == 0)
         {
             existsParam.RequestMethod = existsParam.RequestMethod | gatewayParameterRequestMethod;
         }
         else
         {
             existsParam.RequestMethod = gatewayParameterRequestMethod;
             existsParam.Value = gatewayParameterValue;
         }
     }
 }
예제 #6
0
 /// <summary>
 /// �������ص�����
 /// </summary>
 /// <param name="gatewayParameterName">���صIJ�������</param>
 /// <param name="gatewayParameterValue">���صIJ���ֵ</param>
 /// <param name="gatewayParameterRequestMethod">���صIJ��������󷽷�������</param>
 /// <remarks>
 /// ���õIJ�������ʱ�����������ֵ��һ���򱣴��µIJ���ֵ��
 /// </remarks>
 public void SetGatewayParameterValue(string gatewayParameterName, object gatewayParameterValue, GatewayParameterRequestMethod gatewayParameterRequestMethod)
 {
     SetGatewayParameterValue(gatewayParameterName, gatewayParameterValue.ToString(), gatewayParameterRequestMethod);
 }
예제 #7
0
        /// <summary>
        /// ������صIJ���ֵ��û�в���ֵʱ���ؿ��ַ�����Get��ʽ��ֵ��Ϊδ���롣
        /// </summary>
        /// <param name="gatewayParameterName">���صIJ�������</param>
        /// <param name="gatewayParameterRequestMethod">���ص����ݵ����󷽷�������</param>
        public string GetGatewayParameterValue(string gatewayParameterName, GatewayParameterRequestMethod gatewayParameterRequestMethod)
        {
            GatewayParameter parameter = GatewayParameterData.SingleOrDefault(p => string.Compare(p.Name, gatewayParameterName) == 0 &&
                                                                                   (p.RequestMethod & gatewayParameterRequestMethod) == p.RequestMethod);
            if(parameter != null)
            {
                return parameter.Value;
            }

            return string.Empty;
        }
예제 #8
0
 /// <summary>
 /// 设置网关的数据
 /// </summary>
 /// <param name="gatewayParameterName">网关的参数名称</param>
 /// <param name="gatewayParameterValue">网关的参数值</param>
 /// <param name="gatewayParameterRequestMethod">网关的参数的请求方法的类型</param>
 /// <remarks>
 /// 设置的参数存在时,如果参数的值不一致则保存新的参数值。
 /// </remarks>
 public void SetGatewayParameterValue(string gatewayParameterName, object gatewayParameterValue, GatewayParameterRequestMethod gatewayParameterRequestMethod)
 {
     SetGatewayParameterValue(gatewayParameterName, gatewayParameterValue.ToString(), gatewayParameterRequestMethod);
 }
예제 #9
0
 public GatewayParameter(string parameterName, string parameterValue, GatewayParameterRequestMethod parameterType)
 {
     this.name = parameterName;
     Value = parameterValue;
     RequestMethod = parameterType;
 }
예제 #10
0
        /// <summary>
        /// 设置网关的数据
        /// </summary>
        /// <param name="gatewayParameterName">网关的参数名称</param>
        /// <param name="gatewayParameterValue">网关的参数值</param>
        /// <param name="gatewayParameterRequestMethod">网关的参数的请求方法的类型</param>
        public void SetGatewayParameterValue(string gatewayParameterName, string gatewayParameterValue, GatewayParameterRequestMethod gatewayParameterRequestMethod)
        {
            GatewayParameter existsParam = GatewayParameterData.SingleOrDefault(p => string.Compare(p.Name, gatewayParameterName) == 0);

            if (existsParam == null)
            {
                GatewayParameter param = new GatewayParameter(gatewayParameterName, gatewayParameterValue, gatewayParameterRequestMethod);
                GatewayParameterData.Add(param);
            }
            else
            {
                if (string.Compare(existsParam.Value, gatewayParameterValue) != 0 || existsParam.RequestMethod != gatewayParameterRequestMethod)
                {
                    existsParam.RequestMethod = gatewayParameterRequestMethod;
                    existsParam.Value         = gatewayParameterValue;
                }
            }
        }
예제 #11
0
 /// <summary>
 /// ������صIJ���ֵ��û�в���ֵʱ���ؿ��ַ�����Get��ʽ��ֵ��Ϊδ���롣
 /// </summary>
 /// <param name="gatewayParameterName">���صIJ�������</param>
 /// <param name="gatewayParameterRequestMethod">���ص����ݵ����󷽷�������</param>
 public string GetGatewayParameterValue(string gatewayParameterName, GatewayParameterRequestMethod gatewayParameterRequestMethod)
 {
     return gateway.GetGatewayParameterValue(gatewayParameterName, gatewayParameterRequestMethod);
 }