public static IVsTextLines GetBuffer(this IVsTextView textViewAdapter) { IVsTextLines vsTextLines; ErrorHelper.ThrowOnFailure(textViewAdapter.GetBuffer(out vsTextLines)); return(vsTextLines); }
private static string GetFilePath(IPersistFileFormat persistFileFormat) { string filePath; uint formatIndex; ErrorHelper.ThrowOnFailure(persistFileFormat.GetCurFile(out filePath, out formatIndex)); return(filePath); }
public static ITextView ToITextView(this IVsTextView vsTextView) { object obj2; IVsUserData data = vsTextView as IVsUserData; if (data == null) { throw new InvalidOperationException("The IVsTextView shims should allow us to cast to IVsUserData"); } Guid guidIWpfTextViewHost = GuidIWpfTextViewHost; ErrorHelper.ThrowOnFailure(data.GetData(ref guidIWpfTextViewHost, out obj2)); IWpfTextViewHost host = obj2 as IWpfTextViewHost; return(host.TextView); }
public static ITextBuffer ToITextBuffer(this IVsTextBuffer vsTextBuffer) { object obj2; IVsUserData data = vsTextBuffer as IVsUserData; if (data == null) { throw new InvalidOperationException("The shims should allow us to cast to IVsUserData"); } Guid guidIVxTextBuffer = GuidIVxTextBuffer; ErrorHelper.ThrowOnFailure(data.GetData(ref guidIVxTextBuffer, out obj2)); ITextBuffer buffer = obj2 as ITextBuffer; if (buffer == null) { throw new InvalidOperationException("user data doesnt implement the interface"); } return(buffer); }