Пример #1
0
        private static void InternalLoadMatchDataCallback(IntPtr matchData, IntPtr error, IntPtr secondaryCallback)
        {
            if (PInvokeUtil.IsNull(secondaryCallback))
            {
                return;
            }

            byte[] data = null;

            if (PInvokeUtil.IsNotNull(matchData))
            {
                // Creating a one-time usage NSData binder, so no need to use the factory.
                using (var nsData = new NSData(matchData))
                {
                    var length = nsData.Length;
                    if (length > 0)
                    {
                        data = nsData.GetBytes(length);
                    }
                }
            }

            // A new NSError object is always created on native side, so no need
            // to check the binder pool for reusing an existing one.
            NSError nsError = PInvokeUtil.IsNotNull(error) ? new NSError(error) : null;

            PInvokeCallbackUtil.PerformInternalCallback(
                "GKTurnBasedMatch#InternalLoadMatchDataCallback",
                PInvokeCallbackUtil.Type.Temporary,
                data, nsError, secondaryCallback);
        }