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; } } }
private string GetMultipartBoundary() { return(XRoadHelper.ExtractValue("boundary=", contentTypeHeader, ";")?.Trim().Trim('"')); }
private string GetMultipartStartContentID() { return(XRoadHelper.ExtractValue("start=", contentTypeHeader, ";")?.Trim().Trim('"')); }
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)); }