public static VsTextLinesFromFile Load(string fileName) { VsTextLinesFromFile vsTextLinesFromFile = null; IVsInvisibleEditor invisibleEditor = null; IVsTextLines textBuffer = null; if (RdtManager.IsFileInRdt(fileName)) { // File is in RDT textBuffer = RdtManager.Instance.GetTextLines(fileName); } else { // File is not in RDT, open it in invisible editor. if (!RdtManager.Instance.TryGetTextLinesAndInvisibleEditor(fileName, out invisibleEditor, out textBuffer)) { // Failed to get text lines or invisible editor. textBuffer = null; if (invisibleEditor != null) { Marshal.ReleaseComObject(invisibleEditor); } } } if (textBuffer != null) { vsTextLinesFromFile = new VsTextLinesFromFile(); vsTextLinesFromFile._invisibleEditor = invisibleEditor; vsTextLinesFromFile._textBuffer = textBuffer; } return(vsTextLinesFromFile); }
internal static void InitializeInstance() { if (_instance == null) { lock (_lock) { if (_instance == null) { _instance = new RdtManager(); } } } }