Example #1
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 #2
0
        /// <summary>
        /// Called by the GenericMergeList method
        /// </summary>
        SimpleMethodInfo FindOrCreate(Runner.SimpleMethodInfo fromRunner)
        {
            SimpleMethodInfo foundM = null;

            foreach (SimpleMethodInfo m in _methodsInfoCollection)
            {
                if (m.GetSimpleSignature() == fromRunner.GetSimpleSignature())
                {
                    foundM = m;
                }
            }

            if (foundM != null)
            {
                // Updates the parameter names.
                foundM.Merge(fromRunner);
            }
            else
            {
                foundM = new SimpleMethodInfo();
                foundM.Initialize(fromRunner);
            }
            return(foundM);
        }