Пример #1
0
        /// <summary>
        /// A result is a reply to a specific command
        /// </summary>
        private static void ProcessResult(CallbackMsg_t msg)
        {
            var result = msg.Data.ToType <SteamAPICallCompleted_t>();

            //
            // Do we have an entry added via OnCallComplete
            //
            if (!ResultCallbacks.TryGetValue(result.AsyncCall, out var callbackInfo))
            {
                //
                // This can happen if the callback result was immediately available
                // so we just returned that without actually going through the callback
                // dance. It's okay for this to fail.
                //

                //
                // But still let everyone know that this happened..
                //
                OnDebugCallback?.Invoke((CallbackType)result.Callback, $"[no callback waiting/required]", false);
                return;
            }

            // Remove it before we do anything, incase the continuation throws exceptions
            ResultCallbacks.Remove(result.AsyncCall);

            // At this point whatever async routine called this
            // continues running.
            callbackInfo.continuation();
        }
Пример #2
0
        /// <summary>
        /// A result is a reply to a specific command
        /// </summary>
        private static void ProcessResult(CallbackMsg_t msg)
        {
            var result = msg.Data.ToType <SteamAPICallCompleted_t>();

            //
            // Do we have an entry added via OnCallComplete
            //
            if (!ResultCallbacks.TryGetValue(result.AsyncCall, out var callbackInfo))
            {
                // Do we care? Should we throw errors?
                return;
            }

            // Remove it before we do anything, incase the continuation throws exceptions
            ResultCallbacks.Remove(result.AsyncCall);

            // At this point whatever async routine called this
            // continues running.
            callbackInfo.continuation();
        }