/// <summary> /// Gets text from source code. /// </summary> /// <param name="document">The document.</param> /// <param name="startLine">The start line.</param> /// <returns></returns> public static string GetCodeLineText(TextDocument document, int startLine) { string result = string.Empty; try { if (startLine > 0) { EditPoint ep = document.CreateEditPoint(new LuaTextPoint(document, 1, startLine)); result = ep.GetText(1000); if (!string.IsNullOrEmpty(result)) { using (var reader = new StringReader(result)) { result = reader.ReadLine(); } } } } catch (Exception e) { Trace.WriteLine(e); } return result; }
private string GetText(TextPoint start, TextPoint end) { return(_document.CreateEditPoint(start).GetText(end)); }