/// <summary> /// /// </summary> /// <param name="filepath"></param> /// <param name="entireBuffer"></param> public SourceItem AddItem(string filepath, string entireBuffer, int length, int linecount) { SourceItem srcItem = null; if (string.IsNullOrEmpty(filepath)) return null; // If entireBuffer is null we read file and fill the buffer if (string.IsNullOrEmpty(entireBuffer)) { using (StreamReader sr = new StreamReader(filepath)) { entireBuffer = sr.ReadToEnd(); } } if (!_sources.ContainsKey(filepath)) { srcItem = new SourceItem(entireBuffer, length, linecount); _sources.Add(filepath, srcItem); //StartLexicalAnalysis(); } return srcItem; }
public SourceItem AddItem(ITextBuffer textBuffer) { SourceItem srcItem = null; if (textBuffer == null) return null; string filepath = textBuffer.GetFileName(); if (!_sources.ContainsKey(filepath)) { srcItem = new SourceItem(textBuffer); _sources.Add(filepath, srcItem); } return srcItem; }