public BaseTypeNodeImpl(ITreeNodeGroup treeNodeGroup, ITypeDefOrRef typeDefOrRef, bool isBaseType) { TreeNodeGroup = treeNodeGroup; this.isBaseType = isBaseType; // Keep weak refs to them so we won't prevent removed modules from being GC'd. weakRefTypeDefOrRef = new WeakReference(typeDefOrRef); weakRefResolvedTypeDef = new WeakReference(null); }
ResourceElement resourceElement; // updated by the asm editor, see UpdateData() #endregion Fields #region Constructors protected ResourceElementNode(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement) { if (treeNodeGroup == null || resourceElement == null) throw new ArgumentNullException(); this.treeNodeGroup = treeNodeGroup; this.resourceElement = resourceElement; }
public MessageNode(ITreeNodeGroup treeNodeGroup, Guid guid, ImageReference imgRef, string msg) { this.treeNodeGroup = treeNodeGroup; this.guid = guid; this.imgRef = imgRef; this.msg = msg; }
public DerivedTypesFinder(DocumentTreeNodeData targetNode, TypeDef type) : base(targetNode) { msgNodeGroup = targetNode.Context.DocumentTreeView.DocumentTreeNodeGroups.GetGroup(DocumentTreeNodeGroupType.MessageTreeNodeGroupDerivedTypes); derivedTypesGroup = targetNode.Context.DocumentTreeView.DocumentTreeNodeGroups.GetGroup(DocumentTreeNodeGroupType.DerivedTypeTreeNodeGroupDerivedTypes); weakModules = targetNode.Context.DocumentTreeView.DocumentService.GetDocuments().Where(a => a.ModuleDef != null).SelectMany(a => a.AssemblyDef != null ? (IEnumerable<ModuleDef>)a.AssemblyDef.Modules : new[] { a.ModuleDef }).Select(a => new WeakReference(a)).ToArray(); this.type = type; Start(); }
public AssemblyReferenceNodeImpl(ITreeNodeGroup treeNodeGroup, ModuleDef asmRefOwnerModule, AssemblyRef assemblyRef) { TreeNodeGroup = treeNodeGroup; this.asmRefOwnerModule = new WeakReference(asmRefOwnerModule); // Make sure we don't hold on to the original reference since it could prevent GC of the // owner module. AssemblyRef = assemblyRef.ToAssemblyRef(); AssemblyRef.Rid = assemblyRef.Rid; }
public BamlResourceElementNode(ModuleDef module, ResourceElement resourceElement, byte[] bamlData, ITreeNodeGroup treeNodeGroup, BamlSettings bamlSettings, IXamlOutputOptionsProvider xamlOutputOptionsProvider, IDocumentWriterService documentWriterService) : base(treeNodeGroup, resourceElement) { this.module = module; this.bamlData = bamlData; this.bamlSettings = bamlSettings; this.xamlOutputOptionsProvider = xamlOutputOptionsProvider; this.documentWriterService = documentWriterService; }
public IResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (resourceElement.ResourceData.Code != ResourceTypeCode.ByteArray && resourceElement.ResourceData.Code != ResourceTypeCode.Stream) return null; var data = (byte[])((BuiltInResourceData)resourceElement.ResourceData).Data; if (!BamlReader.IsBamlHeader(new MemoryStream(data))) return null; return new BamlResourceElementNode(module, resourceElement, data, treeNodeGroup, bamlSettings); }
public IResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (resourceElement.ResourceData.Code != ResourceTypeCode.ByteArray && resourceElement.ResourceData.Code != ResourceTypeCode.Stream) return null; var data = (byte[])((BuiltInResourceData)resourceElement.ResourceData).Data; var stream = MemoryImageStream.Create(data); if (!CouldBeImage(resourceElement.Name, stream)) return null; return new ImageResourceElementNode(treeNodeGroup, resourceElement); }
public IResourceNode Create(ModuleDef module, Resource resource, ITreeNodeGroup treeNodeGroup) { var er = resource as EmbeddedResource; if (er == null) return null; er.Data.Position = 0; if (!CouldBeImage(er.Name, er.Data)) return null; return new ImageResourceNode(treeNodeGroup, er); }
public ResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { var serializedData = resourceElement.ResourceData as BinaryResourceData; if (serializedData == null) return null; byte[] imageData; if (SerializedImageUtilities.GetImageData(module, serializedData.TypeName, serializedData.Data, out imageData)) return new SerializedImageResourceElementNodeImpl(treeNodeGroup, resourceElement, imageData); return null; }
public ResourceNode Create(ModuleDef module, Resource resource, ITreeNodeGroup treeNodeGroup) { var er = resource as EmbeddedResource; if (er == null) return null; er.Data.Position = 0; if (!ResourceReader.CouldBeResourcesFile(er.Data)) return null; er.Data.Position = 0; return new ResourceElementSetNodeImpl(treeNodeGroup, module, er); }
public IResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (module == null || resourceElement == null || treeNodeGroup == null) throw new ArgumentNullException(); foreach (var creator in creators) { try { var node = creator.Value.Create(module, resourceElement, treeNodeGroup); if (node != null) return node; } catch { } } return new BuiltInResourceElementNode(treeNodeGroup, resourceElement); }
public ResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (module == null) throw new ArgumentNullException(nameof(module)); if (resourceElement == null) throw new ArgumentNullException(nameof(resourceElement)); if (treeNodeGroup == null) throw new ArgumentNullException(nameof(treeNodeGroup)); foreach (var provider in resourceNodeProviders) { try { var node = provider.Value.Create(module, resourceElement, treeNodeGroup); if (node != null) return node; } catch { } } return new BuiltInResourceElementNodeImpl(treeNodeGroup, resourceElement); }
public IResourceNode Create(ModuleDef module, Resource resource, ITreeNodeGroup treeNodeGroup) { if (module == null || resource == null || treeNodeGroup == null) { throw new ArgumentNullException(); } foreach (var creator in creators) { try { var node = creator.Value.Create(module, resource, treeNodeGroup); if (node != null) { return(node); } } catch { } } return(new UnknownResourceNode(treeNodeGroup, resource)); }
/// <summary> /// Constructor /// </summary> /// <param name="treeNodeGroup">Treenode group</param> /// <param name="resource">Resource</param> protected UnknownResourceNode(ITreeNodeGroup treeNodeGroup, Resource resource) : base(treeNodeGroup, resource) { }
public ResourceElementSetNode(ITreeNodeGroup treeNodeGroup, ModuleDef module, EmbeddedResource resource) : base(treeNodeGroup, resource) { this.module = module; this.resourceElementSet = ResourceReader.Read(module, resource.Data); }
public ReferencesFolderNodeImpl(ITreeNodeGroup treeNodeGroup, ModuleDocumentNode moduleNode) { Debug.Assert(moduleNode.Document.ModuleDef != null); TreeNodeGroup = treeNodeGroup; this.moduleNode = moduleNode; }
public ImageResourceNodeImpl(ITreeNodeGroup treeNodeGroup, EmbeddedResource resource) : base(treeNodeGroup, resource) { imageData = resource.CreateReader().ToArray(); imageSource = ImageResourceUtilities.CreateImageSource(imageData); }
public DocumentTreeNodeData?Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (resourceElement.ResourceData.Code != ResourceTypeCode.ByteArray && resourceElement.ResourceData.Code != ResourceTypeCode.Stream) { return(null); } var data = (byte[])((BuiltInResourceData)resourceElement.ResourceData).Data; var reader = ByteArrayDataReaderFactory.CreateReader(data); if (!CouldBeImage(resourceElement.Name, ref reader)) { return(null); } return(new ImageResourceElementNodeImpl(treeNodeGroup, resourceElement)); }
/// <summary> /// Constructor /// </summary> /// <param name="treeNodeGroup">Treenode group</param> /// <param name="resourceElement">Resource element</param> protected ImageResourceElementNode(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement) : base(treeNodeGroup, resourceElement) { }
public MethodReferenceNodeImpl(ITreeNodeGroup treeNodeGroup, IMethod method) : base(method) => TreeNodeGroup = treeNodeGroup;
public ImageResourceNode(ITreeNodeGroup treeNodeGroup, EmbeddedResource resource) : base(treeNodeGroup, resource) { this.imageData = resource.GetResourceData(); this.imageSource = ImageResourceUtils.CreateImageSource(this.imageData); }
public ImageResourceElementNode(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement) : base(treeNodeGroup, resourceElement) { InitializeImageData(); }
public ResourcesFolderNodeImpl(ITreeNodeGroup treeNodeGroup, ModuleDef module) { TreeNodeGroup = treeNodeGroup; this.module = module; }
/// <summary> /// Constructor /// </summary> /// <param name="treeNodeGroup">Treenode group</param> /// <param name="resource">Resource</param> protected ResourceElementSetNode(ITreeNodeGroup treeNodeGroup, Resource resource) : base(treeNodeGroup, resource) { }
int GetInsertIndex(TreeNodeImpl owner, TreeNodeImpl impl, ITreeNodeGroup group) { var children = owner.Children; // At creation time, it's most likely inserted last, so check that position first. if (children.Count >= 1) { var lastData = children[children.Count - 1].Data; var lastGroup = lastData.TreeNodeGroup; if (lastGroup != null) { int x = Compare(impl.Data, lastData, group, lastGroup); if (x > 0) return children.Count; } } int lo = 0, hi = children.Count - 1; while (lo <= hi && hi != -1) { int i = (lo + hi) / 2; var otherData = children[i].Data; var otherGroup = otherData.TreeNodeGroup; int x; if (otherGroup == null) x = -1; else x = Compare(impl.Data, otherData, group, otherGroup); if (x == 0) return i; if (x < 0) hi = i - 1; else lo = i + 1; } return hi + 1; }
int Compare(ITreeNodeData a, ITreeNodeData b, ITreeNodeGroup ga, ITreeNodeGroup gb) { if (ga.Order < gb.Order) return -1; if (ga.Order > gb.Order) return 1; if (ga.GetType() != gb.GetType()) { Debug.Fail(string.Format("Two different groups have identical order: {0} vs {1}", ga.GetType(), gb.GetType())); return ga.GetType().GetHashCode().CompareTo(gb.GetType().GetHashCode()); } return ga.Compare(a, b); }
public TypeNodeImpl(ITreeNodeGroup treeNodeGroup, TypeDef type) : base(type) { TreeNodeGroup = treeNodeGroup; }
public NamespaceNodeImpl(ITreeNodeGroup treeNodeGroup, string name, List <TypeDef> types) : base(name) { TreeNodeGroup = treeNodeGroup; typesToCreate = types; }
/// <summary> /// Constructor /// </summary> /// <param name="treeNodeGroup">Treenode group</param> /// <param name="resourceElement">Resource element</param> protected BuiltInResourceElementNode(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement) : base(treeNodeGroup, resourceElement) { }
public ModuleReferenceNode(ITreeNodeGroup treeNodeGroup, ModuleRef moduleRef) { this.treeNodeGroup = treeNodeGroup; this.moduleRef = moduleRef; }
public BaseTypeFolderNode(ITreeNodeGroup treeNodeGroup, TypeDef type) { this.treeNodeGroup = treeNodeGroup; this.type = type; }
public TypeReferenceNodeImpl(ITreeNodeGroup treeNodeGroup, ITypeDefOrRef type, TypeRefInfo typeInfo) : base(type) { TreeNodeGroup = treeNodeGroup; this.typeInfo = typeInfo; }
public DerivedTypeNode(ITreeNodeGroup treeNodeGroup, TypeDef type) { this.treeNodeGroup = treeNodeGroup; this.weakRefTypeDef = new WeakReference(type); }
public MessageNodeImpl(ITreeNodeGroup treeNodeGroup, Guid guid, ImageReference imgRef, string msg) { TreeNodeGroup = treeNodeGroup; Guid = guid; this.imgRef = imgRef; Message = msg; }
public ResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) => null;
public ImageResourceElementNodeImpl(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement) : base(treeNodeGroup, resourceElement) => InitializeImageData();
/// <summary> /// Constructor /// </summary> /// <param name="treeNodeGroup">Treenode group</param> /// <param name="resourceElement">Resource element</param> protected SerializedResourceElementNode(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement) : base(treeNodeGroup, resourceElement) => Debug.Assert(resourceElement.ResourceData is BinaryResourceData);
public EventNode(ITreeNodeGroup treeNodeGroup, EventDef @event) { this.TreeNodeGroup = treeNodeGroup; this.EventDef = @event; }
public PropertyNodeImpl(ITreeNodeGroup treeNodeGroup, PropertyDef property) : base(property) => TreeNodeGroup = treeNodeGroup;
/// <summary> /// Constructor /// </summary> /// <param name="treeNodeGroup">Treenode group</param> /// <param name="resource">Resource</param> protected ResourceNode(ITreeNodeGroup treeNodeGroup, Resource resource) { this.treeNodeGroup = treeNodeGroup ?? throw new ArgumentNullException(nameof(treeNodeGroup)); Resource = resource ?? throw new ArgumentNullException(nameof(resource)); }
public ModuleReferenceNodeImpl(ITreeNodeGroup treeNodeGroup, ModuleRef moduleRef) : base(moduleRef) { TreeNodeGroup = treeNodeGroup; }
public ResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (module == null) { throw new ArgumentNullException(nameof(module)); } if (resourceElement == null) { throw new ArgumentNullException(nameof(resourceElement)); } if (treeNodeGroup == null) { throw new ArgumentNullException(nameof(treeNodeGroup)); } foreach (var provider in resourceNodeProviders) { try { var node = provider.Value.Create(module, resourceElement, treeNodeGroup); if (node != null) { return(node); } } catch { } } return(new BuiltInResourceElementNodeImpl(treeNodeGroup, resourceElement)); }
public ResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { var serializedData = resourceElement.ResourceData as BinaryResourceData; if (serializedData == null) { return(null); } byte[] imageData; if (SerializedImageUtilities.GetImageData(module, serializedData.TypeName, serializedData.Data, out imageData)) { return(new SerializedImageResourceElementNodeImpl(treeNodeGroup, resourceElement, imageData)); } return(null); }
public DerivedTypesFolderNodeImpl(ITreeNodeGroup treeNodeGroup, TypeDef type) { TreeNodeGroup = treeNodeGroup; this.type = type; }
public IResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { return null; }
public TypeNodeImpl(ITreeNodeGroup treeNodeGroup, TypeDef type) : base(type) { this.TreeNodeGroup = treeNodeGroup; }
public MethodNode(ITreeNodeGroup treeNodeGroup, MethodDef methodDef) { this.TreeNodeGroup = treeNodeGroup; this.MethodDef = methodDef; }
public ResourceNode Create(ModuleDef module, Resource resource, ITreeNodeGroup treeNodeGroup) => null;
public PropertyNode(ITreeNodeGroup treeNodeGroup, PropertyDef property) { this.treeNodeGroup = treeNodeGroup; this.property = property; }
public SerializedImageResourceElementNodeImpl(ITreeNodeGroup treeNodeGroup, ResourceElement resourceElement, byte[] imageData) : base(treeNodeGroup, resourceElement) { InitializeImageData(imageData); }
public ResourceElementSetNodeImpl(ITreeNodeGroup treeNodeGroup, ModuleDef module, EmbeddedResource resource) : base(treeNodeGroup, resource) { this.module = module; resourceElementSet = ResourceReader.Read(module, resource.GetReader()); }
public DocumentTreeNodeData?Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { var serializedData = resourceElement.ResourceData as BinaryResourceData; if (serializedData is null) { return(null); } if (SerializedImageListStreamerUtilities.GetImageData(module, serializedData.TypeName, serializedData.Data, out var imageData)) { return(new SerializedImageListStreamerResourceElementNodeImpl(treeNodeGroup, resourceElement, imageData)); } return(null); }
public MethodNodeImpl(ITreeNodeGroup treeNodeGroup, MethodDef methodDef) : base(methodDef) => TreeNodeGroup = treeNodeGroup;
public UnknownResourceNodeImpl(ITreeNodeGroup treeNodeGroup, Resource resource) : base(treeNodeGroup, resource) { }
public IResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { if (resourceElement.ResourceData.Code != ResourceTypeCode.ByteArray && resourceElement.ResourceData.Code != ResourceTypeCode.Stream) { return(null); } var data = (byte[])((BuiltInResourceData)resourceElement.ResourceData).Data; var stream = MemoryImageStream.Create(data); if (!CouldBeImage(resourceElement.Name, stream)) { return(null); } return(new ImageResourceElementNode(treeNodeGroup, resourceElement)); }
public DerivedTypeNodeImpl(ITreeNodeGroup treeNodeGroup, TypeDef type) { this.TreeNodeGroup = treeNodeGroup; this.weakRefTypeDef = new WeakReference(type); }
public BaseTypeFolderNode(ITreeNodeGroup treeNodeGroup, TypeDef type) { this.TreeNodeGroup = treeNodeGroup; this.type = type; }