public IAttribute CreateAttribute(IHttpRequest request, string name, long definedSize)
        {
            if (_useDisk)
            {
                var diskAttribute = new DiskAttribute(name, definedSize, _charset, _baseDir, _deleteOnExit)
                {
                    MaxSize = _maxSize
                };
                List <IHttpData> list = GetList(request);
                list.Add(diskAttribute);
                return(diskAttribute);
            }
            if (_checkSize)
            {
                var mixedAttribute = new MixedAttribute(name, definedSize, _minSize, _charset, _baseDir, _deleteOnExit)
                {
                    MaxSize = _maxSize
                };
                List <IHttpData> list = GetList(request);
                list.Add(mixedAttribute);
                return(mixedAttribute);
            }
            var attribute = new MemoryAttribute(name, definedSize)
            {
                MaxSize = _maxSize
            };

            return(attribute);
        }
 public IAttribute CreateAttribute(IHttpRequest request, string name, string value)
 {
     if (_useDisk)
     {
         IAttribute attribute;
         try
         {
             attribute = new DiskAttribute(name, value, _charset, _baseDir, _deleteOnExit)
             {
                 MaxSize = _maxSize
             };
         }
         catch (IOException)
         {
             // revert to Mixed mode
             attribute = new MixedAttribute(name, value, _minSize, _charset, _baseDir, _deleteOnExit)
             {
                 MaxSize = _maxSize
             };
         }
         CheckHttpDataSize(attribute);
         List <IHttpData> list = GetList(request);
         list.Add(attribute);
         return(attribute);
     }
     if (_checkSize)
     {
         var mixedAttribute = new MixedAttribute(name, value, _minSize, _charset, _baseDir, _deleteOnExit)
         {
             MaxSize = _maxSize
         };
         CheckHttpDataSize(mixedAttribute);
         List <IHttpData> list = GetList(request);
         list.Add(mixedAttribute);
         return(mixedAttribute);
     }
     try
     {
         var attribute = new MemoryAttribute(name, value, _charset)
         {
             MaxSize = _maxSize
         };
         CheckHttpDataSize(attribute);
         return(attribute);
     }
     catch (IOException e)
     {
         throw new ArgumentException($"({request}, {name}, {value})", e);
     }
 }
 public IAttribute CreateAttribute(IHttpRequest request, string name, string value)
 {
     if (this.useDisk)
     {
         IAttribute attribute;
         try
         {
             attribute         = new DiskAttribute(name, value, this.charset);
             attribute.MaxSize = this.maxSize;
         }
         catch (IOException)
         {
             // revert to Mixed mode
             attribute         = new MixedAttribute(name, value, this.minSize, this.charset);
             attribute.MaxSize = this.maxSize;
         }
         CheckHttpDataSize(attribute);
         List <IHttpData> list = this.GetList(request);
         list.Add(attribute);
         return(attribute);
     }
     if (this.checkSize)
     {
         var mixedAttribute = new MixedAttribute(name, value, this.minSize, this.charset);
         mixedAttribute.MaxSize = this.maxSize;
         CheckHttpDataSize(mixedAttribute);
         List <IHttpData> list = this.GetList(request);
         list.Add(mixedAttribute);
         return(mixedAttribute);
     }
     try
     {
         var attribute = new MemoryAttribute(name, value, this.charset);
         attribute.MaxSize = this.maxSize;
         CheckHttpDataSize(attribute);
         return(attribute);
     }
     catch (IOException e)
     {
         throw new ArgumentException($"({request}, {name}, {value})", e);
     }
 }
        public IAttribute CreateAttribute(IHttpRequest request, string name)
        {
            if (this.useDisk)
            {
                var diskAttribute = new DiskAttribute(name, this.charset);
                diskAttribute.MaxSize = this.maxSize;
                List <IHttpData> list = this.GetList(request);
                list.Add(diskAttribute);
                return(diskAttribute);
            }
            if (this.checkSize)
            {
                var mixedAttribute = new MixedAttribute(name, this.minSize, this.charset);
                mixedAttribute.MaxSize = this.maxSize;
                List <IHttpData> list = this.GetList(request);
                list.Add(mixedAttribute);
                return(mixedAttribute);
            }
            var attribute = new MemoryAttribute(name);

            attribute.MaxSize = this.maxSize;
            return(attribute);
        }