static void OverrideReadFn(GLib.GType gtype, ReadFnNativeDelegate callback)
 {
     unsafe {
         IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("read_fn"));
         *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback);
     }
 }
示例#2
0
        private long InternalReadFn(IntPtr buffer, ulong count, GLib.Cancellable cancellable)
        {
            ReadFnNativeDelegate unmanaged = class_abi.BaseOverride <ReadFnNativeDelegate>(this.LookupGType(), "read_fn");

            if (unmanaged == null)
            {
                throw new InvalidOperationException("No base method to invoke");
            }

            IntPtr error    = IntPtr.Zero;
            IntPtr __result = unmanaged(this.Handle, buffer, new UIntPtr(count), cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);

            return((long)__result);
        }
        private long InternalReadFn(IntPtr buffer, ulong count, GLib.Cancellable cancellable)
        {
            ReadFnNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("read_fn"));
                unmanaged = (ReadFnNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ReadFnNativeDelegate));
            }
            if (unmanaged == null)
            {
                throw new InvalidOperationException("No base method to invoke");
            }

            IntPtr error    = IntPtr.Zero;
            IntPtr __result = unmanaged(this.Handle, buffer, new UIntPtr(count), cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);

            return((long)__result);
        }
示例#4
0
		static void OverrideReadFn (GLib.GType gtype, ReadFnNativeDelegate callback)
		{
			GInputStreamClass class_iface = GetClassStruct (gtype, false);
			class_iface.ReadFn = callback;
			OverrideClassStruct (gtype, class_iface);
		}