/// <summary> /// Записывает данные запроса с тыпом Text /// </summary> /// <param name="writingStream">Поток для записи данных</param> private void WriteTextParams(MultipartFormDataContent multipartFormDataContent) { using xmlNodeList textList = template.SelectNodes("FormDatas[@Type='Text']"); foreach (xmlElement textParam in textList) { string textKey = GetParamKey(textParam); string textXQValue = sourceObject.XQuery(GetParamValue(textParam)); multipartFormDataContent.Add(new StringContent(textXQValue), textKey); } }
/// <summary> /// Записывает данные запроса с тыпом Text /// </summary> /// <param name="writingStream">Поток для записи данных в байты</param> void WriteTextParams(Stream writingStream) { string textHeaderTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{2}"; using (xmlNodeList textList = template.SelectNodes("FormDatas[@Type='Text']")) { foreach (xmlElement textParam in textList) { string textKey = GetParamKey(textParam); string textValue = GetParamValue(textParam); writingStream.Write(boundarybytes, 0, boundarybytes.Length); byte[] textPartbytes = Encoding.UTF8.GetBytes(string.Format(textHeaderTemplate, textKey, textValue)); writingStream.Write(textPartbytes, 0, textPartbytes.Length); } } }