Beispiel #1
0
 public Registers RegisterMethod(ItemRegister methodRegister)
 {
     methodRegisters.Add(methodRegister);
     //new Thread(() =>
     ItemRegistered?.Invoke(methodRegister);
     //).Start();
     return(this);
 }
Beispiel #2
0
 internal void Register(object obj)
 {
     try
     {
         foreach (MethodInfo info in obj.GetType().GetMethods())
         {
             T attribute = info.GetCustomAttribute <T>(false);
             if (attribute != null)
             {
                 Item item = new Item(attribute, obj, info);
                 _items.Add(item);
                 ItemRegistered?.Invoke(item);
             }
         }
     }
     catch (Exception e)
     {
         Wrapper.Server.Logger.Error("Tried to register an Object from \"" + obj.GetType().FullName + "\" to the Registry for \"" + typeof(T).FullName + "\" but there was an exception!", e);
     }
 }
Beispiel #3
0
 public Registers RegisterAction(ActionRegister actionRegister)
 {
     actionRegisters.Add(actionRegister);
     ItemRegistered?.Invoke(actionRegister);
     return(this);
 }