Example #1
0
        internal bool Merge(PluginDiscoverer.Merger merger, Runner.ServiceReferenceInfo r)
        {
            bool hasChanged = false;

            if (_propertyName != r.PropertyName)
            {
                _propertyName = r.PropertyName;
                hasChanged    = true;
            }
            if (_requirements != r.Requirements)
            {
                _requirements = r.Requirements;
                hasChanged    = true;
            }

            ServiceInfo newService = merger.FindOrCreate(r.Reference);

            if (_reference != newService)
            {
                _reference = newService;
                hasChanged = true;
            }

            PluginInfo newPlugin = merger.FindOrCreate(r.Owner);

            if (_owner != newPlugin)
            {
                _owner     = newPlugin;
                hasChanged = true;
            }

            return(Merge(r, hasChanged));
        }
        internal bool Merge(PluginDiscoverer.Merger merger, Runner.PluginConfigAccessorInfo r)
        {
            bool hasChanged = false;

            if (_source != r.Source)
            {
                _source    = r.Source;
                hasChanged = true;
            }
            if (_configPropertyName != r.ConfigurationPropertyName)
            {
                _configPropertyName = r.ConfigurationPropertyName;
                hasChanged          = true;
            }

            if (_isConfigurationPropertyValid != r.IsConfigurationPropertyValid)
            {
                _isConfigurationPropertyValid = r.IsConfigurationPropertyValid;
                hasChanged = true;
            }

            PluginInfo p = merger.FindOrCreate(r.Plugin);

            if (_plugin != p)
            {
                _plugin    = p;
                hasChanged = true;
            }

            return(Merge(r, hasChanged));
        }
 internal void Initialize(PluginDiscoverer.Merger merger, Runner.PluginConfigAccessorInfo r)
 {
     base.Initialize(r);
     _source                       = r.Source;
     _plugin                       = merger.FindOrCreate(r.Plugin);
     _configPropertyName           = r.ConfigurationPropertyName;
     _isConfigurationPropertyValid = r.IsConfigurationPropertyValid;
 }
Example #4
0
 internal void Initialize(PluginDiscoverer.Merger merger, Runner.ServiceReferenceInfo r)
 {
     base.Initialize(r);
     _propertyName = r.PropertyName;
     _requirements = r.Requirements;
     _reference    = merger.FindOrCreate(r.Reference);
     _owner        = merger.FindOrCreate(r.Owner);
 }
Example #5
0
        internal void Initialize(PluginDiscoverer.Merger merger, Runner.ServiceInfo r)
        {
            _assemblyQualifiedName = r.AssemblyQualifiedName;
            _serviceFullName       = r.ServiceFullName;
            _isDynamicService      = r.IsDynamicService;

            Debug.Assert(!_isDynamicService || (r.HasError || r.AssemblyInfo != null), "If we are a DynamicService, we must have an assembly or be in error.");
            if (r.AssemblyInfo != null)
            {
                _assembly = merger.FindOrCreate(r.AssemblyInfo);
            }

            base.Initialize(r);

            _implCollection = new List <PluginInfo>();
            foreach (Runner.PluginInfo plugin in r.Implementations)
            {
                _implCollection.Add(merger.FindOrCreate(plugin));
            }

            _impl = new ReadOnlyListOnIList <PluginInfo>(_implCollection);

            _propertiesInfoCollection = new List <SimplePropertyInfo>();
            foreach (Runner.SimplePropertyInfo rP in r.PropertiesInfoCollection)
            {
                SimplePropertyInfo p = new SimplePropertyInfo();
                p.Initialize(rP);
                _propertiesInfoCollection.Add(p);
            }
            _propertiesInfoCollectionEx = new ReadOnlyListOnIList <SimplePropertyInfo>(_propertiesInfoCollection);

            _methodsInfoCollection = new List <SimpleMethodInfo>();
            foreach (Runner.SimpleMethodInfo rM in r.MethodsInfoCollection)
            {
                SimpleMethodInfo m = new SimpleMethodInfo();
                m.Initialize(rM);
                _methodsInfoCollection.Add(m);
            }

            _methodsInfoCollectionEx = new ReadOnlyListOnIList <SimpleMethodInfo>(_methodsInfoCollection);

            _eventsInfoCollection = new List <SimpleEventInfo>();
            foreach (Runner.SimpleEventInfo rE in r.EventsInfoCollection)
            {
                SimpleEventInfo e = new SimpleEventInfo();
                e.Initialize(rE);
                _eventsInfoCollection.Add(e);
            }

            _eventsInfoCollectionEx = new ReadOnlyListOnIList <SimpleEventInfo>(_eventsInfoCollection);
        }
Example #6
0
        internal bool Merge(PluginDiscoverer.Merger merger, Runner.ServiceInfo r)
        {
            bool hasChanged = false;

            if (_assemblyQualifiedName != r.AssemblyQualifiedName)
            {
                _assemblyQualifiedName = r.AssemblyQualifiedName;
                hasChanged             = true;
            }
            if (_serviceFullName != r.ServiceFullName)
            {
                _serviceFullName = r.ServiceFullName;
                hasChanged       = true;
            }
            if (_isDynamicService != r.IsDynamicService)
            {
                _isDynamicService = r.IsDynamicService;
                hasChanged        = true;
            }

            PluginAssemblyInfo newAI = r.AssemblyInfo != null?merger.FindOrCreate(r.AssemblyInfo) : null;

            if (_assembly != newAI)
            {
                _assembly  = newAI;
                hasChanged = true;
            }

            if (PluginDiscoverer.Merger.GenericMergeLists(_implCollection, r.Implementations, merger.FindOrCreate, null))
            {
                hasChanged = true;
            }

            if (PluginDiscoverer.Merger.GenericMergeLists(_methodsInfoCollection, r.MethodsInfoCollection, FindOrCreate, null))
            {
                hasChanged = true;
            }

            if (PluginDiscoverer.Merger.GenericMergeLists(_eventsInfoCollection, r.EventsInfoCollection, FindOrCreate, null))
            {
                hasChanged = true;
            }

            if (PluginDiscoverer.Merger.GenericMergeLists(_propertiesInfoCollection, r.PropertiesInfoCollection, FindOrCreate, null))
            {
                hasChanged = true;
            }

            return(Merge(r, hasChanged));
        }
Example #7
0
 internal ServiceReferenceInfo FindOrCreate( PluginDiscoverer.Merger merger, Runner.ServiceReferenceInfo serviceRef )
 {
     ServiceReferenceInfo f;
     if( !_dicServiceReferences.TryGetValue( serviceRef, out f ) )
     {
         f = new ServiceReferenceInfo( Discoverer );
         _dicServiceReferences.Add( serviceRef, f );
         f.Initialize( merger, serviceRef );
     }
     else
     {
         if( f.LastChangedVersion != Discoverer.CurrentVersion )
             f.Merge( merger, serviceRef );
     }
     return f;
 }
Example #8
0
        internal void Initialize( PluginDiscoverer.Merger merger, Runner.PluginInfo r )
        {
            base.Initialize( r );
            
            _pluginId = r.PluginId;
            _name = r.PublicName;
            _pluginFullName = r.PluginFullName;
            _desc = r.Description;
            _url = r.RefUrl;
            _version = r.Version;
            _iconUri = r.IconUri;
            _isOldVersion = r.IsOldVersion;
            _assemblyInfo = merger.FindOrCreate( r.AssemblyInfo );

            Debug.Assert( r.Categories != null );
            _categoriesCollection = r.Categories;
            _categories = new ReadOnlyListOnIList<string>( _categoriesCollection );

            if( r.EditorsInfo != null )
            {
                _editorsCollection = new List<PluginConfigAccessorInfo>();
                foreach( Runner.PluginConfigAccessorInfo editor in r.EditorsInfo )
                    _editorsCollection.Add( merger.FindOrCreate( editor ) );
            }

            _servicesReferencesCollection = new List<ServiceReferenceInfo>();
            _dicServiceReferences = new Dictionary<Runner.ServiceReferenceInfo, ServiceReferenceInfo>();
            foreach( Runner.ServiceReferenceInfo service in r.ServiceReferences )
                _servicesReferencesCollection.Add( FindOrCreate( merger, service ) );

            if( r.Service != null )
            {
                _service = merger.FindOrCreate( r.Service );
            }
            _editableByCollection = new List<PluginConfigAccessorInfo>();
            foreach( Runner.PluginConfigAccessorInfo editor in r.EditableBy )
                _editableByCollection.Add( merger.FindOrCreate( editor ) );

            _serviceReferences = new ReadOnlyListOnIList<ServiceReferenceInfo>( _dicServiceReferences.Values.ToList() );
            _editorsInfo = new ReadOnlyListOnIList<PluginConfigAccessorInfo>( _editorsCollection );
            _editableBy = new ReadOnlyListOnIList<PluginConfigAccessorInfo>( _editableByCollection );
            _serviceReferences = new ReadOnlyListOnIList<ServiceReferenceInfo>( _dicServiceReferences.Values.ToList() );
            _editorsInfo = new ReadOnlyListOnIList<PluginConfigAccessorInfo>( _editorsCollection );
        }
        internal void Initialize(PluginDiscoverer.Merger merger, Runner.PluginAssemblyInfo r)
        {
            base.Initialize(r);
            _fileName     = r.AssemblyFileName;
            _assemblyName = r.AssemblyName;
            _fileSize     = r.AssemblyFileSize;

            foreach (Runner.PluginInfo plugin in r.Plugins)
            {
                _pluginsCollection.Add(merger.FindOrCreate(plugin));
            }

            foreach (Runner.ServiceInfo service in r.Services)
            {
                _servicesCollection.Add(merger.FindOrCreate(service));
            }

            _plugins  = new ReadOnlyListOnIList <PluginInfo>(_pluginsCollection);
            _services = new ReadOnlyListOnIList <ServiceInfo>(_servicesCollection);
        }
        internal bool Merge(PluginDiscoverer.Merger merger, Runner.PluginAssemblyInfo r)
        {
            bool hasChanged = false;

            if (_fileName != r.AssemblyFileName)
            {
                _fileName  = r.AssemblyFileName;
                hasChanged = true;
            }
            // AssemblyName does not override Equals.
            // We use the Fullname This is perfect for strongly signed assembly, not necessary
            // for unsigned ones.
            // This is why we added the file size to the AssemblyInfo: file size gives
            // us a way to detect file change even if its name (typically through its version) is not updated.
            bool rHasAssemblyName = r.AssemblyName != null;

            if ((_assemblyName != null) != rHasAssemblyName || (rHasAssemblyName && _assemblyName.FullName != r.AssemblyName.FullName))
            {
                _assemblyName = r.AssemblyName;
                hasChanged    = true;
            }

            if (_fileSize != r.AssemblyFileSize)
            {
                _fileSize  = r.AssemblyFileSize;
                hasChanged = true;
            }

            if (PluginDiscoverer.Merger.GenericMergeLists(_pluginsCollection, r.Plugins, merger.FindOrCreate, null))
            {
                hasChanged = true;
            }

            if (PluginDiscoverer.Merger.GenericMergeLists(_servicesCollection, r.Services, merger.FindOrCreate, null))
            {
                hasChanged = true;
            }

            return(Merge(r, hasChanged));
        }
Example #11
0
        internal bool Merge( PluginDiscoverer.Merger merger, Runner.PluginInfo r )
        {
            bool hasChanged = false;

            if( _pluginId != r.PluginId )
            {
                _pluginId = r.PluginId;
                hasChanged = true;
            }
            if( _name != r.PublicName )
            {
                _name = r.PublicName;
                hasChanged = true;
            }
            if( _pluginFullName != r.PluginFullName )
            {
                _pluginFullName = r.PluginFullName;
                hasChanged = true;
            }
            if( _desc != r.Description )
            {
                _desc = r.Description;
                hasChanged = true;
            }
            if( _url != r.RefUrl )
            {
                _url = r.RefUrl;
                hasChanged = true;
            }
            if( _version != r.Version )
            {
                _version = r.Version;
                hasChanged = true;
            }
            if( _iconUri != r.IconUri )
            {
                _iconUri = r.IconUri;
                hasChanged = true;
            }
            if( _isOldVersion != r.IsOldVersion )
            {
                _isOldVersion = r.IsOldVersion;
                hasChanged = true;
            }
            
            Debug.Assert( _categories != null && r.Categories != null, "Already initialized." );
            if( !_categories.SequenceEqual( r.Categories, StringComparer.Ordinal ) )
            {
                _categoriesCollection = r.Categories;
                _categories = new ReadOnlyListOnIList<string>( _categoriesCollection );
                hasChanged = true;
            }
            
            PluginAssemblyInfo newAI = merger.FindOrCreate( r.AssemblyInfo );
            if( _assemblyInfo != newAI )
            {
                _assemblyInfo = newAI;
                hasChanged = true;
            }

            if( PluginDiscoverer.Merger.GenericMergeLists( _servicesReferencesCollection, r.ServiceReferences, ( s ) => { return FindOrCreate( merger, s ); }, null ) )
            {
                hasChanged = true;
            }

            // r.Service can be null, some checks have to be made:
            if( r.Service == null )
            {
                if( _service != null )
                {
                    _service = null;
                    hasChanged = true;
                }
            }
            else
            {
                ServiceInfo s = merger.FindOrCreate( r.Service );
                if( _service != s )
                {
                    _service = s;
                    hasChanged = true;
                }
            }

            if ( PluginDiscoverer.Merger.GenericMergeLists( _editorsCollection, r.EditorsInfo, merger.FindOrCreate, null ) )
            {
                hasChanged = true;
            }

            if( PluginDiscoverer.Merger.GenericMergeLists( _editableByCollection, r.EditableBy, merger.FindOrCreate, null ) )
            {
                hasChanged = true;
            }

            return Merge( r, hasChanged );
        }