static IMessage MakeMessageInternal( TextMessageCapture capture, IRegex headRe, IRegex bodyRe, ref IMatch bodyMatch, FieldsProcessor.IFieldsProcessor fieldsProcessor, FieldsProcessor.MakeMessageFlags makeMessageFlags, DateTime sourceTime, ITimeOffsets timeOffsets, MessagesBuilderCallback threadLocalCallbackImpl ) { if (bodyRe != null) { if (!bodyRe.Match(capture.BodyBuffer, capture.BodyIndex, capture.BodyLength, ref bodyMatch)) { return(null); } } int idx = 0; Group[] groups; fieldsProcessor.Reset(); fieldsProcessor.SetSourceTime(sourceTime); fieldsProcessor.SetPosition(capture.BeginPosition); fieldsProcessor.SetTimeOffsets(timeOffsets); groups = capture.HeaderMatch.Groups; for (int i = 1; i < groups.Length; ++i) { var g = groups[i]; fieldsProcessor.SetInputField(idx++, new StringSlice(capture.HeaderBuffer, g.Index, g.Length)); } if (bodyRe != null) { groups = bodyMatch.Groups; for (int i = 1; i < groups.Length; ++i) { var g = groups[i]; fieldsProcessor.SetInputField(idx++, new StringSlice(capture.BodyBuffer, g.Index, g.Length)); } } else { fieldsProcessor.SetInputField(idx++, new StringSlice(capture.BodyBuffer, capture.BodyIndex, capture.BodyLength)); } threadLocalCallbackImpl.SetCurrentPosition(capture.BeginPosition, capture.EndPosition); threadLocalCallbackImpl.SetRawText(StringSlice.Concat(capture.MessageHeaderSlice, capture.MessageBodySlice).Trim()); var ret = fieldsProcessor.MakeMessage(threadLocalCallbackImpl, makeMessageFlags); return(ret); }