Exemplo n.º 1
0
        private void RegisterProducers(List <string> eventsIncluded, List <string> eventsExcluded, Assembly assembly)
        {
            var scanner = assembly.GetTypes()
                          .Where(t => t.BaseType != null && t.BaseType.Equals(typeof(EventBase)))
                          .Select(t => new EventType(t))
                          .Where(e =>
            {
                if (eventsIncluded.Count > 0)
                {
                    return(eventsIncluded.Contains(e.Name));
                }

                if (eventsExcluded.Count > 0)
                {
                    return(!eventsExcluded.Contains(e.Name));
                }

                return(true);
            })
                          .AsEnumerable();

            foreach (var e in scanner)
            {
                SubscriptionsManager.AddOrUpdateProducer(e);
            }
        }