Ejemplo n.º 1
0
        internal static bool IsOverridden(DiscordClientService service, string name, params Type[] types)
        {
            var serviceType = service.GetType();
            var method      = serviceType.GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic, null, types, null);

            return(method != null && method.DeclaringType != null && method.DeclaringType != method.GetBaseDefinition().DeclaringType);
        }
Ejemplo n.º 2
0
 private async ValueTask ExecuteAsync <TEventArgs>(Func <DiscordClientService, TEventArgs, ValueTask> factory,
                                                   DiscordClientService service, TEventArgs e)
 {
     try
     {
         await factory(service, e).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex, "An exception occurred while executing {0}.{1}().", service.GetType().Name, "On" + e.GetType().Name.Replace("EventArgs", ""));
     }
 }
Ejemplo n.º 3
0
        private static bool IsOverridden(DiscordClientService service, string name)
        {
            var method = service.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic);

            return(method != null && method.DeclaringType != typeof(DiscordClientService));
        }