private void ProcessResponse() { string responseContentType = this.RequestExecutor.ResponseContentType; HttpStatusCode statusCode = this.RequestExecutor.StatusCode; string boundary; bool flag = this.IsMultiPartMime(responseContentType, out boundary); if (statusCode != HttpStatusCode.OK || (!responseContentType.StartsWith("application/json") && !flag)) { this.m_requestStatus = ClientRequestStatus.CompletedException; throw new ClientRequestException(Resources.GetString("RequestUnexpectedResponseWithContentTypeAndStatus", new object[] { responseContentType, statusCode })); } this.m_context.ProcessingResponse = true; try { using (Stream responseStream = this.RequestExecutor.GetResponseStream()) { MimeReader mimeReader = null; Stream responseStream2 = responseStream; if (flag) { mimeReader = new MimeReader(responseStream, boundary); if (!mimeReader.ReadNextPart()) { throw new ClientRequestException(Resources.GetString("RequestUnexpectedResponseWithContentTypeAndStatus", new object[] { responseContentType, statusCode })); } responseStream2 = mimeReader.GetContentStream(); } this.ProcessResponseStream(responseStream2); if (flag) { while (mimeReader.ReadNextPart()) { int num = 2000; int num2 = num; MimeHeaders mimeHeaders = mimeReader.ReadHeaders(num, ref num2); if (mimeHeaders.ContentID != null && !string.IsNullOrEmpty(mimeHeaders.ContentID.Value)) { string text = mimeHeaders.ContentID.Value; if (text.StartsWith("<", StringComparison.Ordinal) && text.EndsWith(">", StringComparison.Ordinal)) { text = text.Substring(1, text.Length - 2); } ChunkStreamBuilder chunkStreamBuilder = new ChunkStreamBuilder(); chunkStreamBuilder.CopyFrom(mimeReader.GetContentStream()); this.Context.AddStream(text, chunkStreamBuilder); } } } this.m_requestStatus = ClientRequestStatus.CompletedSuccess; } } catch (Exception ex) { this.m_requestStatus = ClientRequestStatus.CompletedException; throw; } finally { this.m_context.ProcessingResponse = false; this.RequestExecutor.Dispose(); } }