public static void Combine(object rcw, Guid iid, int dispid, Delegate d) { rcw = ComEventsHelper.UnwrapIfTransparentProxy(rcw); lock (rcw) { ComEventsInfo local_2 = ComEventsInfo.FromObject(rcw); ComEventsSink local_3 = local_2.FindSink(ref iid) ?? local_2.AddSink(ref iid); (local_3.FindMethod(dispid) ?? local_3.AddMethod(dispid)).AddDelegate(d); } }
public static Delegate Remove(object rcw, Guid iid, int dispid, Delegate d) { rcw = ComEventsHelper.UnwrapIfTransparentProxy(rcw); object obj = rcw; Delegate result; lock (obj) { ComEventsInfo comEventsInfo = ComEventsInfo.Find(rcw); if (comEventsInfo == null) { result = null; } else { ComEventsSink comEventsSink = comEventsInfo.FindSink(ref iid); if (comEventsSink == null) { result = null; } else { ComEventsMethod comEventsMethod = comEventsSink.FindMethod(dispid); if (comEventsMethod == null) { result = null; } else { comEventsMethod.RemoveDelegate(d); if (comEventsMethod.Empty) { comEventsMethod = comEventsSink.RemoveMethod(comEventsMethod); } if (comEventsMethod == null) { comEventsSink = comEventsInfo.RemoveSink(comEventsSink); } if (comEventsSink == null) { Marshal.SetComObjectData(rcw, typeof(ComEventsInfo), null); GC.SuppressFinalize(comEventsInfo); } result = d; } } } } return(result); }
public static void Combine(object rcw, Guid iid, int dispid, Delegate d) { rcw = ComEventsHelper.UnwrapIfTransparentProxy(rcw); object obj = rcw; lock (obj) { ComEventsInfo comEventsInfo = ComEventsInfo.FromObject(rcw); ComEventsSink comEventsSink = comEventsInfo.FindSink(ref iid); if (comEventsSink == null) { comEventsSink = comEventsInfo.AddSink(ref iid); } ComEventsMethod comEventsMethod = comEventsSink.FindMethod(dispid); if (comEventsMethod == null) { comEventsMethod = comEventsSink.AddMethod(dispid); } comEventsMethod.AddDelegate(d); } }
public static Delegate Remove(object rcw, Guid iid, int dispid, Delegate d) { rcw = ComEventsHelper.UnwrapIfTransparentProxy(rcw); lock (rcw) { ComEventsInfo local_2 = ComEventsInfo.Find(rcw); if (local_2 == null) { return((Delegate)null); } ComEventsSink local_3 = local_2.FindSink(ref iid); if (local_3 == null) { return((Delegate)null); } ComEventsMethod local_4 = local_3.FindMethod(dispid); if (local_4 == null) { return((Delegate)null); } local_4.RemoveDelegate(d); if (local_4.Empty) { local_4 = local_3.RemoveMethod(local_4); } if (local_4 == null) { local_3 = local_2.RemoveSink(local_3); } if (local_3 == null) { Marshal.SetComObjectData(rcw, (object)typeof(ComEventsInfo), (object)null); GC.SuppressFinalize((object)local_2); } return(d); } }