Class ExtensionMethodsTooling
Provides a set of extension methods to open source code elements declarations with a text editor tool (like Visual Studio), or even compare source declarations with a diff tool.
public static class ExtensionMethodsTooling
- Inheritance
-
ExtensionMethodsTooling
- Inherited Members
Methods (5)
TryCompareSourceWith(ISourceDecl, ISourceDecl)
Opens with a textual files compare/diff tool, two source files declarations, this sourceDecl and sourceDeclOther.
public static bool TryCompareSourceWith(this ISourceDecl sourceDecl, ISourceDecl sourceDeclOther)
Parameters
sourceDeclISourceDeclThe first line position in a source file.
sourceDeclOtherISourceDeclThe second line position in a source file.
Returns
- bool
true if the two source declarations were compared successfully.
Remarks
sourceDecl and sourceDeclOther can be obtained through ICodeElement.SourceDecls.
The textual files compare/diff tool is defined through: NDepend > Options panel > Build Comparison > Sources Files Compare Tool
This method can only be invoked within a .NET Framework 4.x and Windows OS context else it throws a NotSupportedException.
- See Also
TryCompareSourceWith(ISourceDecl, ISourceDecl, out string)
Opens with a textual files compare/diff tool, two source files declarations, this sourceDecl and sourceDeclOther.
public static bool TryCompareSourceWith(this ISourceDecl sourceDecl, ISourceDecl sourceDeclOther, out string failureReason)
Parameters
sourceDeclISourceDeclThe first line position in a source file.
sourceDeclOtherISourceDeclThe second line position in a source file.
failureReasonstringIf false is returned, contains the plain-english description of the failure.
Returns
- bool
true if the two source declarations were compared successfully.
Remarks
sourceDecl and sourceDeclOther can be obtained through ICodeElement.SourceDecls.
The textual files compare/diff tool is defined through: NDepend > Options panel > Build Comparison > Sources Files Compare Tool
This method can only be invoked within a .NET Framework 4.x and Windows OS context else it throws a NotSupportedException.
- See Also
TryDiffSource(ICodeElement, ICompareContext, out string)
Opens with a textual files compare/diff tool, the older and newer source versions of codeElement.
public static bool TryDiffSource(this ICodeElement codeElement, ICompareContext compareContext, out string failureReason)
Parameters
codeElementICodeElementThe code element to open the source from
compareContextICompareContextThe compare context from which we can get the older version of the
codeElement.failureReasonstringIf false is returned, contains the plain-english description of the failure.
Returns
Remarks
If source files get zipped at analysis time, the older source file version is this zipped version.
The textual files compare/diff tool is defined through: NDepend > Options panel > Build Comparison > Sources Files Compare Tool.
If codeElement has more than one SourceDecls, this method fails.
In this situation you can use instead the method TryCompareSourceWith(ISourceDecl, ISourceDecl)
to compare source files older/newer versions one by one.
This method can only be invoked within a .NET Framework 4.x and Windows OS context else it throws a NotSupportedException.
- See Also
TryOpenSource(ICodeElement)
Opens the source file containing the declaration of this ICodeElement, and points to the declaration line.
public static bool TryOpenSource(this ICodeElement codeElement)
Parameters
codeElementICodeElementThe code element.
Returns
- bool
true if the source declaration was opened successfully.
Remarks
Code elements such as IType, INamespace or IAssembly objects, often have multiple source declarations in the sequence SourceDecls.
In such a case, a dialog is shown to the user asking which declaration should be opened.
The source file declaration is opened in the editor tool defined through: NDepend > Options panel > Source File Editor Tool
This method can only be invoked within a .NET Framework 4.x and Windows OS context else it throws a NotSupportedException.
TryOpenSource(ICodeElement, out string)
Opens the source file containing the declaration of this ICodeElement, and points to the declaration line.
public static bool TryOpenSource(this ICodeElement codeElement, out string failureReason)
Parameters
codeElementICodeElementThe code element.
failureReasonstringIf false is returned, contains the plain-english description of the failure.
Returns
- bool
true if the source declaration was opened successfully.
Remarks
Code elements such as IType, INamespace or IAssembly objects, often have multiple source declarations in the sequence SourceDecls.
In such a case, a dialog is shown to the user asking which declaration should be opened.
The source file declaration is opened in the editor tool defined through: NDepend > Options panel > Source File Editor Tool
This method can only be invoked within a .NET Framework 4.x and Windows OS context else it throws a NotSupportedException.