public override object Execute(MulticastDelegate dele, ParameterCollection parameters) { try { return dele.DynamicInvoke(parameters.AllParameterValues); } catch (Exception ex) { return this.ExecuteOnException(ex, parameters); } }
public override object Execute(MulticastDelegate dele, ParameterCollection parameters) { try { return dele.DynamicInvoke(parameters.AllParameterValues); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ResetColor(); throw; } }
public override object Execute(MulticastDelegate dele, ParameterCollection parameters) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Prefix: {0}", _prefix); Console.WriteLine("Suffix: {0}", _suffix); Console.WriteLine("Name: {0}", this.Name); if (_allTypes != null) { Console.WriteLine("All types: {0}", _allTypes); } Console.WriteLine("Intercepted {0}::{1}", dele.Target.GetType().FullName, dele.Method.Name); if (parameters.Dictionary.Count > 0) { Console.WriteLine("Args:"); foreach (KeyValuePair<string, object> kvp in parameters.Dictionary) { Console.WriteLine(" {0} -> {1}", kvp.Key, kvp.Value); } } Console.ResetColor(); // invoke the intercepted method object result = dele.DynamicInvoke(parameters.AllParameterValues); Console.ForegroundColor = ConsoleColor.Green; if (dele.Method.ReturnType != typeof(void)) { Console.WriteLine("Return:"); Console.WriteLine(" {0}", result); } Console.ResetColor(); return result; }
public override object Execute(MulticastDelegate dele, ParameterCollection parameters) { object result = dele.DynamicInvoke(parameters.AllParameterValues); return this.ExecuteAfter(result, parameters); }
public abstract object ExecuteAfter(object result, ParameterCollection parameters);
public abstract object Execute(MulticastDelegate dele, ParameterCollection parameters);
public abstract object ExecuteOnException(Exception exception, ParameterCollection parameters);
public override object Execute(MulticastDelegate dele, ParameterCollection parameters) { return null; }
public override object Execute(MulticastDelegate dele, ParameterCollection parameters) { this.ExecuteBefore(parameters); return dele.DynamicInvoke(parameters.AllParameterValues); }
public abstract void ExecuteBefore(ParameterCollection parameters);