Ejemplo n.º 1
0
        public static void ClearListeners()
        {
            try
            {
                if (OnDebug != null)
                {
                    foreach (Delegate invoker in OnDebug.GetInvocationList())
                    {
                        OnDebug -= (LogEventHandler)invoker;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            try
            {
                if (OnError != null)
                {
                    foreach (Delegate invoker in OnError.GetInvocationList())
                    {
                        OnError -= (LogEventHandler)invoker;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            try
            {
                if (OnFatal != null)
                {
                    foreach (Delegate invoker in OnFatal.GetInvocationList())
                    {
                        OnFatal -= (LogEventHandler)invoker;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            try
            {
                if (OnInfo != null)
                {
                    foreach (Delegate invoker in OnInfo.GetInvocationList())
                    {
                        OnInfo -= (LogEventHandler)invoker;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            try
            {
                if (OnVerbose != null)
                {
                    foreach (Delegate invoker in OnVerbose.GetInvocationList())
                    {
                        OnVerbose -= (LogEventHandler)invoker;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            try
            {
                if (OnWarn != null)
                {
                    foreach (Delegate invoker in OnWarn.GetInvocationList())
                    {
                        OnWarn -= (LogEventHandler)invoker;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
 private void Verbose(string format, params object[] args)
 {
     OnVerbose?.Invoke(this, new VerboseEventArgs(string.Format(format, args)));
 }
Ejemplo n.º 3
0
 private static void LogCall(string callName) =>
 OnVerbose?.Invoke($"[VERBOSE] NativeInterface: calling {callName}.");