Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        private void OnAssemblyRemoved(AssemblyDefinition definition, AssemblyStream source)
        {
            var handler = AssemblyRemoved;

            if (handler != null)
            {
                handler(this, new AssemblyDefinitionEventArgs(definition, source));
            }
        }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 7
0
 public void LoadAssembly(AssemblyStream source, bool raiseEvent = true)
 {
   LoadAssembly(source, AssemblyDefinition.ReadAssembly(source.OpenRead()), raiseEvent);
 }
Exemplo n.º 8
0
 private void OnAssemblyRemoved(AssemblyDefinition definition, AssemblyStream source)
 {
   var handler = AssemblyRemoved;
   if (handler != null) handler(this, new AssemblyDefinitionEventArgs(definition, source));
 }
 public AssemblyDefinitionEventArgs(AssemblyDefinition definition, AssemblyStream source)
 {
   Definition = definition;
   Source = source;
 }
Exemplo n.º 10
0
 private void LoadOrReplaceAssembly(AssemblyDefinition definition, AssemblyStream source)
 {
   var assemblyView = new AssemblyNode(definition, source);
   AddOrReplaceAssemblyView(definition.IsSilverlight() ? SilverlightAssemblies : NetAssemblies, assemblyView);
 }
Exemplo n.º 11
0
    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);
    }