Beispiel #1
0
        public static Type GetReceiverType(string type)
        {
            if (!_name2receiver.ContainsKey(type))
            {
                throw new ArgumentException("Unknown receiver type: " + type);
            }

            LogEventReceiverInfo ri = _name2receiver[type];

            return(ri.Type);
        }
Beispiel #2
0
        public static ILogEventReceiver CreateLogReceiver(string type)
        {
            if (!_name2receiver.ContainsKey(type))
            {
                throw new ArgumentException("Unknown receiver type: " + type);
            }

            LogEventReceiverInfo ri    = _name2receiver[type];
            object            o        = Activator.CreateInstance(ri.Type);
            ILogEventReceiver receiver = (ILogEventReceiver)o;

            return(receiver);
        }
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         _selectedLogReceiver = listView1.SelectedItems[0].Tag as LogEventReceiverInfo;
     }
     else
     {
         _selectedLogReceiver = null;
     }
     EventArgs args = new EventArgs();
     if (ReceiverChanged != null)
         ReceiverChanged(this, args);
 }
Beispiel #4
0
        private static void AddReceiversFromAssembly(Assembly assembly)
        {
            foreach (Type t in assembly.GetExportedTypes())
            {
                if (!t.IsDefined(typeof(LogEventReceiverAttribute), false))
                {
                    continue;
                }

                LogEventReceiverAttribute attr = (LogEventReceiverAttribute)Attribute.GetCustomAttribute(t, typeof(LogEventReceiverAttribute), false);
                LogEventReceiverInfo      ri   = new LogEventReceiverInfo();

                ri.Name        = attr.Name;
                ri.Summary     = attr.Summary;
                ri.Description = attr.Description;
                ri.Type        = t;
                AddReceiverInfo(ri);
                logger.Debug("Adding receiver to factory {0} ({1})", ri, t.AssemblyQualifiedName);
            }
        }
Beispiel #5
0
 public static void AddReceiverInfo(LogEventReceiverInfo ri)
 {
     _name2receiver[ri.Name] = ri;
     _receivers.Add(ri);
 }
 public SelectLogReceiverPropertyPage()
 {
     _selectedLogReceiver = null;
     InitializeComponent();
 }