示例#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);
        }
示例#2
0
        /// <summary>
        ///  Called by the GenericMergeList method
        /// </summary>
        /// <param name="rE"></param>
        /// <returns></returns>
        SimpleEventInfo FindOrCreate(Runner.SimpleEventInfo rE)
        {
            SimpleEventInfo foundE = null;

            foreach (SimpleEventInfo p in this._eventsInfoCollection)
            {
                if (p.Name == rE.Name)
                {
                    foundE = p;
                }
            }

            if (foundE != null)
            {
                foundE.Merge(rE);
            }
            else
            {
                foundE = new SimpleEventInfo();
                foundE.Initialize(rE);
            }
            return(foundE);
        }