Ejemplo n.º 1
0
        public void AddTextPart(string value, Encoding encoding = null, IEnumerable <KeyValuePair <string, string> > properties = null)
        {
            var content = encoding == null
                                ? new StringContent(value)
                                : new StringContent(value, encoding);

            foreach (var property in properties)
            {
                content.Headers.Add(property.Key, property.Value);
            }
            MultiPartContents.Add(content);
        }
Ejemplo n.º 2
0
        public void AddFilePart(string name, Stream stream, int bufferSize, IEnumerable <KeyValuePair <string, string> > properties = null)
        {
            var content = bufferSize == -1
                                ? new StreamContent(stream)
                                : new StreamContent(stream, bufferSize);

            foreach (var property in properties)
            {
                content.Headers.Add(property.Key, property.Value);
            }
            MultiPartContents.Add(content);
        }