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);
            }
        }
Exemple #2
0
        protected void _setPtr(IntPtr ptr)
        {
            D.assert(ptr != IntPtr.Zero);
            _ptr = ptr;

            _isolate = Isolate.current;
            _isolate.addNativeWrapper(this);
        }
 static void Mono_shutdown(IntPtr isolate)
 {
     try {
         Isolate.shutdown(isolate);
     }
     catch (Exception ex) {
         Debug.LogException(ex);
     }
 }
Exemple #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);
            }
        }
Exemple #5
0
 public static IDisposable getScope(Isolate isolate)
 {
     D.assert(isolate != null && isolate.isValid);
     return(new _IsolateDisposable(isolate._ptr));
 }