static void OverrideReadAsync(GLib.GType gtype, ReadAsyncNativeDelegate callback)
 {
     unsafe {
         IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("read_async"));
         *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback);
     }
 }
示例#2
0
        private void InternalReadAsync(IntPtr buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
        {
            ReadAsyncNativeDelegate unmanaged = class_abi.BaseOverride <ReadAsyncNativeDelegate>(this.LookupGType(), "read_async");

            if (unmanaged == null)
            {
                return;
            }

            GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper(cb);
            cb_wrapper.PersistUntilCalled();
            unmanaged(this.Handle, buffer, new UIntPtr(count), io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
        }
        private void InternalReadAsync(IntPtr buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
        {
            ReadAsyncNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("read_async"));
                unmanaged = (ReadAsyncNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ReadAsyncNativeDelegate));
            }
            if (unmanaged == null)
            {
                return;
            }

            GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper(cb);
            cb_wrapper.PersistUntilCalled();
            unmanaged(this.Handle, buffer, new UIntPtr(count), io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
        }
示例#4
0
		static void OverrideReadAsync (GLib.GType gtype, ReadAsyncNativeDelegate callback)
		{
			GInputStreamClass class_iface = GetClassStruct (gtype, false);
			class_iface.ReadAsync = callback;
			OverrideClassStruct (gtype, class_iface);
		}