internal bool LineIsInBlock(int functionNo, int LineNumber) { // Can't be in this block - its in a different function... if (functionNo != this._functionNo) { return(false); } // Is it in this block ? if (LineNumber <= _block_end_lineno && LineNumber >= _block_start_lineno) { return(true); } // It it in any child blocks ? if (this.Nodes != null) { foreach (TreeNode t in this.Nodes) { if (t is MyLocationNode) { MyLocationNode mln = t as MyLocationNode; if (mln.LineIsInBlock(functionNo, LineNumber)) { return(true); } } } } // no.. return(false); }
public override string ToString() { string path; if (t == null) { return(""); } try { if (!lastIsSuggestion) { path = t.FullPath; path = path.Replace("\\", "-->"); } else { if (t is MyLocationNode) { MyLocationNode mln = t as MyLocationNode; if (mln.LineIsInBlock(_functionNo, LineNumber)) { // We in the last command... path = t.FullPath; path = path.Replace("\\", "-->"); } else { // We're after the last command path = t.FullPath; path = path.Replace("\\", "-->"); // We now need to remove the last portion and replace it with our own line.. int l = path.LastIndexOf("-->"); path = path.Substring(0, l + 3); path += _lineText; } } else { path = t.FullPath; path = path.Replace("\\", "-->"); // We now need to remove the last portion and replace it with our own line.. int l = path.LastIndexOf("-->"); path = path.Substring(0, l + 3); path += _lineText; } } return(path); } catch (Exception e) { return(""); } }