示例#1
0
        static unsafe void _sendPlatformMessageCallback(IntPtr callbackHandle, byte *data, int dataLength)
        {
            GCHandle handle   = (GCHandle)callbackHandle;
            var      callback = (PlatformMessageResponseCallback)handle.Target;

            handle.Free();

            if (!Isolate.checkExists())
            {
                return;
            }

            byte[] bytes = null;
            if (data != null && dataLength != 0)
            {
                bytes = new byte[dataLength];
                Marshal.Copy((IntPtr)data, bytes, 0, dataLength);
            }

            try {
                callback(bytes);
            }
            catch (Exception ex) {
                Debug.LogException(ex);
            }
        }
示例#2
0
        protected void _setPtr(IntPtr ptr)
        {
            D.assert(ptr != IntPtr.Zero);
            _ptr = ptr;

            _isolate = Isolate.current;
            _isolate.addNativeWrapper(this);
        }
示例#3
0
 static void Mono_shutdown(IntPtr isolate)
 {
     try {
         Isolate.shutdown(isolate);
     }
     catch (Exception ex) {
         Debug.LogException(ex);
     }
 }
示例#4
0
        static void _toImageCallback(IntPtr callbackHandle, IntPtr result)
        {
            GCHandle handle   = (GCHandle)callbackHandle;
            var      callback = (_Callback <Image>)handle.Target;

            handle.Free();

            if (!Isolate.checkExists())
            {
                return;
            }

            try {
                callback(result == IntPtr.Zero ? null : new Image(result));
            }
            catch (Exception ex) {
                Debug.LogException(ex);
            }
        }
示例#5
0
 public static IDisposable getScope(Isolate isolate)
 {
     D.assert(isolate != null && isolate.isValid);
     return(new _IsolateDisposable(isolate._ptr));
 }