|
|
|
@ -17,11 +17,11 @@
@@ -17,11 +17,11 @@
|
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Diagnostics; |
|
|
|
|
using ICSharpCode.Decompiler.TypeSystem; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.ILSpy.TreeNodes |
|
|
|
|
{ |
|
|
|
|
/*[ExportContextMenuEntry(Header = "Search MSDN...", Icon = "images/SearchMsdn.png", Order = 9999)] |
|
|
|
|
[ExportContextMenuEntry(Header = "Search MSDN...", Icon = "images/SearchMsdn.png", Order = 9999)] |
|
|
|
|
internal sealed class SearchMsdnContextMenuEntry : IContextMenuEntry |
|
|
|
|
{ |
|
|
|
|
private static string msdnAddress = "http://msdn.microsoft.com/en-us/library/{0}"; |
|
|
|
@ -47,34 +47,42 @@ namespace ICSharpCode.ILSpy.TreeNodes
@@ -47,34 +47,42 @@ namespace ICSharpCode.ILSpy.TreeNodes
|
|
|
|
|
|
|
|
|
|
foreach (var node in context.SelectedTreeNodes) |
|
|
|
|
{ |
|
|
|
|
var typeNode = node as TypeTreeNode; |
|
|
|
|
if (typeNode != null && !typeNode.IsPublicAPI) |
|
|
|
|
if (node is TypeTreeNode typeNode && !typeNode.IsPublicAPI) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
var eventNode = node as EventTreeNode; |
|
|
|
|
if (eventNode != null && (!eventNode.IsPublicAPI || !eventNode.EventDefinition.DeclaringType.IsPublic)) |
|
|
|
|
if (node is EventTreeNode eventNode && (!eventNode.IsPublicAPI || !IsAccessible(eventNode.EventDefinition))) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
var fieldNode = node as FieldTreeNode; |
|
|
|
|
if (fieldNode != null && (!fieldNode.IsPublicAPI || !fieldNode.FieldDefinition.DeclaringType.IsPublic)) |
|
|
|
|
if (node is FieldTreeNode fieldNode && (!fieldNode.IsPublicAPI || !IsAccessible(fieldNode.FieldDefinition))) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
var propertyNode = node as PropertyTreeNode; |
|
|
|
|
if (propertyNode != null && (!propertyNode.IsPublicAPI || !propertyNode.PropertyDefinition.DeclaringType.IsPublic)) |
|
|
|
|
if (node is PropertyTreeNode propertyNode && (!propertyNode.IsPublicAPI || !IsAccessible(propertyNode.PropertyDefinition))) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
var methodNode = node as MethodTreeNode; |
|
|
|
|
if (methodNode != null && (!methodNode.IsPublicAPI || !methodNode.MethodDefinition.DeclaringType.IsPublic)) |
|
|
|
|
if (node is MethodTreeNode methodNode && (!methodNode.IsPublicAPI || !IsAccessible(methodNode.MethodDefinition))) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
var namespaceNode = node as NamespaceTreeNode; |
|
|
|
|
if (namespaceNode != null && string.IsNullOrEmpty(namespaceNode.Name)) |
|
|
|
|
if (node is NamespaceTreeNode namespaceNode && string.IsNullOrEmpty(namespaceNode.Name)) |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool IsAccessible(IEntity entity) |
|
|
|
|
{ |
|
|
|
|
if (entity.DeclaringTypeDefinition == null) |
|
|
|
|
return false; |
|
|
|
|
switch (entity.DeclaringTypeDefinition.Accessibility) { |
|
|
|
|
case Accessibility.Public: |
|
|
|
|
case Accessibility.Protected: |
|
|
|
|
case Accessibility.ProtectedOrInternal: |
|
|
|
|
return true; |
|
|
|
|
default: |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Execute(TextViewContext context) |
|
|
|
|
{ |
|
|
|
|
if (context.SelectedTreeNodes != null) { |
|
|
|
@ -108,5 +116,5 @@ namespace ICSharpCode.ILSpy.TreeNodes
@@ -108,5 +116,5 @@ namespace ICSharpCode.ILSpy.TreeNodes
|
|
|
|
|
if (!string.IsNullOrEmpty(address)) |
|
|
|
|
MainWindow.OpenLink(address); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
} |