コード例 #1
0
 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);
        }
コード例 #3
0
        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
ファイル: InputStream.cs プロジェクト: akrisiun/gtk-sharp
		static void OverrideReadFn (GLib.GType gtype, ReadFnNativeDelegate callback)
		{
			GInputStreamClass class_iface = GetClassStruct (gtype, false);
			class_iface.ReadFn = callback;
			OverrideClassStruct (gtype, class_iface);
		}