public void LoadAssembly(AssemblyStream source, AssemblyDefinition definition, bool raiseEvent = true) { Debug.Assert(source != null, "Source cannot be null"); Debug.Assert(definition != null, "Definition cannot be null"); // do nothing if assembly instance already exists if (_assemblies.Contains(definition)) { return; } // check whether different instance of this assembly already exists var existing = _assemblies.FirstOrDefault(asm => asm.FullName.Equals(definition.FullName, StringComparison.OrdinalIgnoreCase)); // remove existing instance as we may want to update assembly if (existing != null) { _assemblies.Remove(existing); } // register new instance _assemblies.Add(definition); // cache reference to source stream _assemblyStreams[definition] = source; // raise appropriate event if (raiseEvent) { OnAssemblyAdded(definition, source); } }
private void OnAssemblyRemoved(AssemblyDefinition definition, AssemblyStream source) { var handler = AssemblyRemoved; if (handler != null) { handler(this, new AssemblyDefinitionEventArgs(definition, source)); } }
public FileNode(AssemblyStream source, string resourcePath) : base(null) { if (source == null) throw new ArgumentNullException("source"); if (string.IsNullOrWhiteSpace(resourcePath)) throw new ArgumentNullException("resourcePath"); _source = source; _resourcePath = resourcePath; _fileName = Path.GetFileName(_resourcePath); _extension = Path.GetExtension(_fileName); if (!string.IsNullOrEmpty(_extension)) _extension = _extension.ToLowerInvariant(); Header = CreateHeaderCore(DefaultImages.AssemblyBrowser.GetFileIcon(_fileName), null, resourcePath, true); DefaultStyleKey = typeof(FileNode); CompositionInitializer.SatisfyImports(this); }
public void LoadAssembly(AssemblyStream source, AssemblyDefinition definition, bool raiseEvent = true) { Debug.Assert(source != null, "Source cannot be null"); Debug.Assert(definition != null, "Definition cannot be null"); // do nothing if assembly instance already exists if (_assemblies.Contains(definition)) return; // check whether different instance of this assembly already exists var existing = _assemblies.FirstOrDefault(asm => asm.FullName.Equals(definition.FullName, StringComparison.OrdinalIgnoreCase)); // remove existing instance as we may want to update assembly if (existing != null) _assemblies.Remove(existing); // register new instance _assemblies.Add(definition); // cache reference to source stream _assemblyStreams[definition] = source; // raise appropriate event if (raiseEvent) OnAssemblyAdded(definition, source); }
public void LoadAssembly(AssemblyStream source, bool raiseEvent = true) { LoadAssembly(source, AssemblyDefinition.ReadAssembly(source.OpenRead()), raiseEvent); }
public AssemblyDefinitionEventArgs(AssemblyDefinition definition, AssemblyStream source) { Definition = definition; Source = source; }
private void OnAssemblyRemoved(AssemblyDefinition definition, AssemblyStream source) { var handler = AssemblyRemoved; if (handler != null) handler(this, new AssemblyDefinitionEventArgs(definition, source)); }
private void LoadOrReplaceAssembly(AssemblyDefinition definition, AssemblyStream source) { var assemblyView = new AssemblyNode(definition, source); AddOrReplaceAssemblyView(definition.IsSilverlight() ? SilverlightAssemblies : NetAssemblies, assemblyView); }
private void LoadAssembly(AssemblyDefinition definition, AssemblyStream source) { var node = new AssemblyNode(definition, source); if (definition.IsSilverlight()) SilverlightAssemblies.Items.Add(node); else NetAssemblies.Items.Add(node); }