public static void TryGoTo(AbstractEntity entity) { if (entity == null) throw new ArgumentNullException("entity"); while ((entity is IMember) && ((IMember)entity).GenericMember is AbstractEntity) entity = (AbstractEntity)((IMember)entity).GenericMember; // Try to find the assembly which contains the resolved type IProjectContent pc = entity.ProjectContent; ReflectionProjectContent rpc = pc as ReflectionProjectContent; string assemblyLocation = null; if (rpc != null) { assemblyLocation = GetAssemblyLocation(rpc); } else { IProject project = pc.Project as IProject; if (project != null) { assemblyLocation = project.OutputAssemblyFullPath; } } if (string.IsNullOrEmpty(assemblyLocation)) { MessageService.ShowWarning("ILSpy AddIn: Could not determine the assembly location for " + entity.FullyQualifiedName + "."); return; } string ilspyPath = GetILSpyExeFullPathInteractive(); if (string.IsNullOrEmpty(ilspyPath)) return; string commandLine = "/singleInstance \"" + assemblyLocation + "\" \"/navigateTo:" + entity.DocumentationTag + "\""; LoggingService.Debug(ilspyPath + " " + commandLine); Process.Start(ilspyPath, commandLine); }
void ReadAttributes(AbstractEntity decoration) { int count = reader.ReadUInt16(); if (count > 0) { ReadAttributes(decoration.Attributes, count); } else { decoration.Attributes = DefaultAttribute.EmptyAttributeList; } }
protected void CopyDocumentationFrom(IEntity entity) { AbstractEntity ae = entity as AbstractEntity; if (ae != null) { this.Documentation = ae.documentation; // do not cause pc.GetXmlDocumentation call for documentation copy } else { this.Documentation = entity.Documentation; } }
// ******************************************************************************************************************************** public static void TryGoTo(string assemblyName, AbstractEntity entity) { string dotnetName = entity.DocumentationTag.Replace('+', '.'); string selectCommand; if (entity is IClass) { selectCommand = "SelectTypeDeclaration"; } else if (entity is IEvent) { selectCommand = "SelectEventDeclaration"; } else if (entity is IProperty) { selectCommand = "SelectPropertyDeclaration"; } else if (entity is IField) { selectCommand = "SelectFieldDeclaration"; } else { selectCommand = "SelectMethodDeclaration"; } ThreadPool.QueueUserWorkItem(state => DoTryGoto(assemblyName, selectCommand, dotnetName)); }
void ConvertAttributes(NRefactoryAST.AttributedNode from, AbstractEntity to) { if (from.Attributes.Count == 0) { to.Attributes = DefaultAttribute.EmptyAttributeList; } else { ICSharpCode.NRefactory.Location location = from.Attributes[0].StartLocation; ClassFinder context; if (to is IClass) { context = new ClassFinder((IClass)to, location.Line, location.Column); } else { context = new ClassFinder(to.DeclaringType, location.Line, location.Column); } to.Attributes = VisitAttributes(from.Attributes, context); } }
void ConvertAttributes(AST.TypeMember node, AbstractEntity to) { if (node.Attributes.Count == 0) { to.Attributes = DefaultAttribute.EmptyAttributeList; } else { ClassFinder context; if (to is IClass) { context = new ClassFinder((IClass)to, node.LexicalInfo.Line, node.LexicalInfo.Column); } else { context = new ClassFinder(to.DeclaringType, node.LexicalInfo.Line, node.LexicalInfo.Column); } foreach (AST.Attribute a in node.Attributes) { to.Attributes.Add(new DefaultAttribute(new AttributeReturnType(context, a.Name)) { CompilationUnit = _cu, Region = GetRegion(a) }); } } to.Documentation = node.Documentation; }