Пример #1
0
        /// <summary>
        ///     Posts this Event on a GameObject.
        /// </summary>
        /// <param name="gameObject">The GameObject</param>
        /// <param name="flags"></param>
        /// <param name="callback"></param>
        /// <param name="cookie">Optional cookie received by the callback</param>
        /// <returns>Returns the playing ID.</returns>
        public uint Post(UnityEngine.GameObject gameObject, CallbackFlags flags, AkCallbackManager.EventCallback callback,
                         object cookie = null)
        {
            if (!IsValid())
            {
                return(AkSoundEngine.AK_INVALID_PLAYING_ID);
            }

            var playingId = AkSoundEngine.PostEvent(Id, gameObject, flags.value, callback, cookie);

            VerifyPlayingID(playingId);
            return(playingId);
        }
Пример #2
0
        ///////////////////////////////////////////////////////////////////////

        public static bool HasFlags(
            CallbackFlags flags,
            CallbackFlags hasFlags,
            bool all
            )
        {
            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != CallbackFlags.None);
            }
        }
Пример #3
0
        /// <summary>
        /// Binds the routine delegate.
        /// </summary>
        /// <returns>Instance to the delegate. Cannot be <c>null</c>.</returns>
        private PhpCallable BindNew(Context ctx)
        {
            var resolved = BindCore(ctx);

            if (resolved == null)
            {
                _flags  |= CallbackFlags.IsInvalid;
                resolved = InvokeError;
            }

            //

            _lazyResolved = resolved;

            return(resolved);
        }
Пример #4
0
 public PurgeProgressChangedEventArgs(long spaceFreed, long spaceToFree, CallbackFlags flags)
 {
     SpaceFreed  = spaceFreed;
     SpaceToFree = spaceToFree;
     Flags       = flags;
 }
Пример #5
0
 public ScanProgressChangedEventArgs(long spaceUsed, CallbackFlags flags) => (SpaceUsed, Flags) = (spaceUsed, flags);
Пример #6
0
        ///////////////////////////////////////////////////////////////////////

        public static ReturnCode UploadDataAsync(
            Interpreter interpreter,
            IClientData clientData,
            StringList arguments,
            CallbackFlags callbackFlags,
            Uri uri,
            string method,
            byte[] rawData,
            ref Result error
            )
        {
            TraceOps.DebugTrace(String.Format(
                                    "UploadDataAsync: interpreter = {0}, clientData = {1}, " +
                                    "arguments = {2}, callbackFlags = {3}, uri = {4}, " +
                                    "method = {5}, rawData = {6}",
                                    FormatOps.InterpreterNoThrow(interpreter),
                                    FormatOps.WrapOrNull(clientData),
                                    FormatOps.WrapOrNull(true, true, arguments),
                                    FormatOps.WrapOrNull(callbackFlags),
                                    FormatOps.WrapOrNull(uri),
                                    FormatOps.WrapOrNull(method),
                                    FormatOps.WrapOrNull(rawData)),
                                typeof(WebOps).Name, TracePriority.NetworkDebug);

            ReturnCode code      = ReturnCode.Ok;
            WebClient  webClient = null;

            try
            {
                ICallback callback = CommandCallback.Create(
                    MarshalFlags.Default, callbackFlags,
                    ObjectFlags.Callback, ByRefArgumentFlags.None,
                    interpreter, null, null, arguments, ref error);

                if (callback != null)
                {
                    try
                    {
                        Result localError = null;

                        webClient = CreateClient(
                            interpreter, "UploadDataAsync", clientData,
                            ref localError);

                        if (webClient != null)
                        {
                            callback.ClientData = new ClientData(
                                new AnyTriplet <WebClient, Uri,
                                                IAnyPair <string, byte[]> >(
                                    webClient, uri, new AnyPair <string,
                                                                 byte[]>(method, rawData)));

                            webClient.UploadDataCompleted +=
                                new UploadDataCompletedEventHandler(
                                    UploadDataAsyncCompleted);

                            /* NO RESULT */
                            webClient.UploadDataAsync(
                                uri, method, rawData, callback);
                        }
                        else if (localError != null)
                        {
                            error = localError;
                            code  = ReturnCode.Error;
                        }
                        else
                        {
                            error = "could not create web client";
                            code  = ReturnCode.Error;
                        }
                    }
                    catch (Exception e)
                    {
                        error = e;
                        code  = ReturnCode.Error;
                    }
                }
                else
                {
                    code = ReturnCode.Error;
                }
            }
            finally
            {
                if ((code != ReturnCode.Ok) && (webClient != null))
                {
                    ReturnCode disposeCode;
                    Result     disposeError = null;

                    disposeCode = ObjectOps.TryDispose(
                        webClient, ref disposeError);

                    if (disposeCode != ReturnCode.Ok)
                    {
                        DebugOps.Complain(
                            interpreter, disposeCode, disposeError);
                    }
                }
            }

            return(code);
        }