Beispiel #1
0
        /// <summary>
        ///     Parse the stream into a new instance of the <see cref="MultipartFormDataParser" /> class
        ///     with the boundary, input encoding and buffer size.
        /// </summary>
        /// <param name="stream">
        ///     The stream containing the multipart data.
        /// </param>
        /// <param name="boundary">
        ///     The multipart/form-data boundary. This should be the value
        ///     returned by the request header.
        /// </param>
        /// <param name="encoding">
        ///     The encoding of the multipart data.
        /// </param>
        /// <param name="binaryBufferSize">
        ///     The size of the buffer to use for parsing the multipart form data. This must be larger
        ///     then (size of boundary + 4 + # bytes in newline).
        /// </param>
        /// <returns>
        ///     A new instance of the <see cref="MultipartFormDataParser"/> class.
        /// </returns>
        public static MultipartFormDataParser Parse(Stream stream, string boundary, Encoding encoding, int binaryBufferSize)
        {
            var parser = new MultipartFormDataParser();

            parser.ParseStream(stream, boundary, encoding, binaryBufferSize);
            return(parser);
        }
Beispiel #2
0
        /// <summary>
        ///     Parse the stream into a new instance of the <see cref="MultipartFormDataParser" /> class
        ///     with the boundary, input encoding and buffer size.
        /// </summary>
        /// <param name="stream">
        ///     The stream containing the multipart data.
        /// </param>
        /// <param name="boundary">
        ///     The multipart/form-data boundary. This should be the value
        ///     returned by the request header.
        /// </param>
        /// <param name="encoding">
        ///     The encoding of the multipart data.
        /// </param>
        /// <param name="binaryBufferSize">
        ///     The size of the buffer to use for parsing the multipart form data. This must be larger
        ///     then (size of boundary + 4 + # bytes in newline).
        /// </param>
        /// <param name="binaryMimeTypes">
        ///     List of mimetypes that should be detected as file.
        /// </param>
        /// <returns>
        ///     A new instance of the <see cref="MultipartFormDataParser"/> class.
        /// </returns>
        public static MultipartFormDataParser Parse(Stream stream, string boundary = null, Encoding encoding = null, int binaryBufferSize = DefaultBufferSize, string[] binaryMimeTypes = null)
        {
            var parser = new MultipartFormDataParser();

            parser.ParseStream(stream, boundary, encoding, binaryBufferSize, binaryMimeTypes);
            return(parser);
        }