public string BinaryMatchToString(SearchParams searchParams) { string formatted = string.Empty; if (searchParams.ShowLineNumbers) { formatted += IndexToString(Index); } if (searchParams.ContextLinesCount > 0) { for (int idx = 0; idx < ContextPre.Count; idx++) { formatted += " " + ContextPre.ElementAt(idx); } } formatted += " " + Value; if (searchParams.ContextLinesCount > 0) { for (int idx = 0; idx < ContextPost.Count; idx++) { formatted += " " + ContextPost.ElementAt(idx); } } formatted += Environment.NewLine; return(formatted); }
public string TextMatchToString(SearchParams searchParams) { string formatted = string.Empty; if (searchParams.ContextLinesCount > 0) { for (int idx = 0; idx < ContextPre.Count; idx++) { if (searchParams.ShowLineNumbers) { formatted += string.Format("{0} {1}", IndexToString(Index - (ContextPre.Count - idx), true), ContextPre.ElementAt(idx)) + Environment.NewLine; } else { formatted += ContextPre.ElementAt(idx) + Environment.NewLine; } } } if (searchParams.ShowLineNumbers) { formatted += string.Format("{0} {1}", IndexToString(Index), Value) + Environment.NewLine; } else { formatted += Value + Environment.NewLine; } if (searchParams.ContextLinesCount > 0) { for (int idx = 0; idx < ContextPost.Count; idx++) { if (searchParams.ShowLineNumbers) { formatted += string.Format("{0} {1}", IndexToString(Index + 1 + idx, true), ContextPost.ElementAt(idx)) + Environment.NewLine; } else { formatted += ContextPre.ElementAt(idx) + Environment.NewLine; } } } return(formatted); }