Пример #1
0
        private void ExtractMultipartHeader(Encoding contentEncoding, out string partID, out string partTransferEncoding)
        {
            partID = partTransferEncoding = null;

            while (true)
            {
                var buffer = ReadLine();

                var lastLine = contentEncoding.GetString(buffer).Trim();
                if (string.IsNullOrEmpty(lastLine))
                {
                    break;
                }

                var tempContentID = XRoadHelper.ExtractValue("content-id:", lastLine, null);
                if (tempContentID != null)
                {
                    partID = tempContentID.Trim().Trim('<', '>');
                }

                var tempTransferEncoding = XRoadHelper.ExtractValue("content-transfer-encoding:", lastLine, null);
                if (tempTransferEncoding != null)
                {
                    partTransferEncoding = tempTransferEncoding;
                }
            }
        }
Пример #2
0
 private string GetMultipartBoundary()
 {
     return(XRoadHelper.ExtractValue("boundary=", contentTypeHeader, ";")?.Trim().Trim('"'));
 }
Пример #3
0
 private string GetMultipartStartContentID()
 {
     return(XRoadHelper.ExtractValue("start=", contentTypeHeader, ";")?.Trim().Trim('"'));
 }
Пример #4
0
        private Encoding GetContentEncoding()
        {
            var contentType = XRoadHelper.ExtractValue("charset=", contentTypeHeader, ";")?.Trim().Trim('"');

            return(string.IsNullOrWhiteSpace(contentType) || contentType.ToUpper().Equals("UTF-8") ? XRoadEncoding.Utf8 : Encoding.GetEncoding(contentType));
        }