private IList<string> ExtractUnmatched(string srcText, IRTEntry[] source) { IList<string> unmatched = new List<string>(); int srcNextIndex = 0; for (int i = 0; i < source.Length; i++) { if (source[i].DataSource.SourceStartIndex > srcNextIndex) { unmatched.Add(srcText.Substring(srcNextIndex, source[i].DataSource.SourceStartIndex - srcNextIndex)); } unmatched.Add(null); srcNextIndex = source[i].DataSource.SourceEndIndex + 1; } if (srcNextIndex < srcText.Length) { unmatched.Add(srcText.Substring(srcNextIndex)); } return unmatched; }
public string Execute(string srcText, IRTEntry[] source) { Init(); RTExecutionContext context = new RTPostContext(srcText, source, _factory); var result = _interpreter.Execute(context); if (context.HasError) { throw new RTExecutionException(context.Errors, ErrorMessages.Post_Execution_Error); } if (result == null) { return null; } else { return result.ToString(); } }
public RTPostContext(string srcText, IRTEntry[] mergeInput, IRTMetadataFactory factory) : base(factory) { this._srcText = srcText; this._mergeInput = mergeInput; }