Пример #1
0
 private bool ParameterBehavior(IHttpBehavior behavior, string paramName, PartAttribute attr, EnctypeAttribute enctype, int argIndex, Encoding encoding, Formatters.IFormatter formatter)
 {
     if (attr == null)
     {
         return(false);
     }
     if (!attr.IsFile)
     {
         var pb = new HttpParameterBehavior(paramName, argIndex, encoding, formatter)
         {
             IsEncodeKey   = enctype.DefaultEncodeKey,
             IsEncodeValue = enctype.DefaultEncodeValue
         };
         behavior.PartKeys.Add(new HttpStringParameterStreamWrapperBehavior(pb));
     }
     else
     {
         behavior.PartKeys.Add(new HttpFileParameterBehavior(paramName, argIndex, encoding));
     }
     return(true);
 }
Пример #2
0
        private bool ParameterBehavior(IHttpBehavior behavior, string paramName, FieldAttribute attr, EnctypeAttribute enctype, int argIndex, Encoding encoding, Formatters.IFormatter formatter)
        {
            if (attr == null)
            {
                return(false);
            }
            var pb = new HttpParameterBehavior(paramName, argIndex, encoding, formatter)
            {
                IsEncodeKey   = attr.IsEncodeKey ?? enctype.DefaultEncodeKey,
                IsEncodeValue = attr.IsEncodeValue ?? enctype.DefaultEncodeValue
            };

            if (enctype is MultipartAttribute)
            {
                behavior.PartKeys.Add(new HttpStringParameterStreamWrapperBehavior(pb));
            }
            else
            {
                behavior.FieldKeys.Add(pb);
            }
            return(true);
        }