ProxyPluginMgrCallback.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.9
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace org.doubango.tinyWRAP {
  9. using System;
  10. using System.Runtime.InteropServices;
  11. public class ProxyPluginMgrCallback : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal ProxyPluginMgrCallback(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(ProxyPluginMgrCallback obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~ProxyPluginMgrCallback() {
  22. Dispose();
  23. }
  24. public virtual void Dispose() {
  25. lock(this) {
  26. if (swigCPtr.Handle != IntPtr.Zero) {
  27. if (swigCMemOwn) {
  28. swigCMemOwn = false;
  29. tinyWRAPPINVOKE.delete_ProxyPluginMgrCallback(swigCPtr);
  30. }
  31. swigCPtr = new HandleRef(null, IntPtr.Zero);
  32. }
  33. GC.SuppressFinalize(this);
  34. }
  35. }
  36. public ProxyPluginMgrCallback() : this(tinyWRAPPINVOKE.new_ProxyPluginMgrCallback(), true) {
  37. SwigDirectorConnect();
  38. }
  39. public virtual int OnPluginCreated(ulong id, twrap_proxy_plugin_type_t type) {
  40. int ret = (SwigDerivedClassHasMethod("OnPluginCreated", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginCreatedSwigExplicitProxyPluginMgrCallback(swigCPtr, id, (int)type) : tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginCreated(swigCPtr, id, (int)type));
  41. return ret;
  42. }
  43. public virtual int OnPluginDestroyed(ulong id, twrap_proxy_plugin_type_t type) {
  44. int ret = (SwigDerivedClassHasMethod("OnPluginDestroyed", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginDestroyedSwigExplicitProxyPluginMgrCallback(swigCPtr, id, (int)type) : tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginDestroyed(swigCPtr, id, (int)type));
  45. return ret;
  46. }
  47. private void SwigDirectorConnect() {
  48. if (SwigDerivedClassHasMethod("OnPluginCreated", swigMethodTypes0))
  49. swigDelegate0 = new SwigDelegateProxyPluginMgrCallback_0(SwigDirectorOnPluginCreated);
  50. if (SwigDerivedClassHasMethod("OnPluginDestroyed", swigMethodTypes1))
  51. swigDelegate1 = new SwigDelegateProxyPluginMgrCallback_1(SwigDirectorOnPluginDestroyed);
  52. tinyWRAPPINVOKE.ProxyPluginMgrCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1);
  53. }
  54. private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
  55. System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
  56. bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyPluginMgrCallback));
  57. return hasDerivedMethod;
  58. }
  59. private int SwigDirectorOnPluginCreated(ulong id, int type) {
  60. return OnPluginCreated(id, (twrap_proxy_plugin_type_t)type);
  61. }
  62. private int SwigDirectorOnPluginDestroyed(ulong id, int type) {
  63. return OnPluginDestroyed(id, (twrap_proxy_plugin_type_t)type);
  64. }
  65. public delegate int SwigDelegateProxyPluginMgrCallback_0(ulong id, int type);
  66. public delegate int SwigDelegateProxyPluginMgrCallback_1(ulong id, int type);
  67. private SwigDelegateProxyPluginMgrCallback_0 swigDelegate0;
  68. private SwigDelegateProxyPluginMgrCallback_1 swigDelegate1;
  69. private static Type[] swigMethodTypes0 = new Type[] { typeof(ulong), typeof(twrap_proxy_plugin_type_t) };
  70. private static Type[] swigMethodTypes1 = new Type[] { typeof(ulong), typeof(twrap_proxy_plugin_type_t) };
  71. }
  72. }