Beispiel #1
0
        private void StrictModeCheck(ICallInfo callInfo)
        {
            string errorMsg;

            if (!callInfo.StrictModeCheck(out errorMsg))
            {
                var infoTypeName = callInfo.GetType().ToString();
                ((IGamePlugin)this).ReportError(Photon.Hive.Plugin.ErrorCodes.MissingCallProcessing, null, infoTypeName);
                callInfo.Fail(errorMsg);
            }
        }
Beispiel #2
0
        private static void HttpRequestCallback(IPluginHttpUtilClient client, HttpRequest request, HttpRequestQueueResultCode result, AsyncHttpRequest httpRequest, object state, ICallInfo info)
        {
            var callInfo = (ICallInfoImpl)info;

            var doCheck = !callInfo.IsProcessed;

            if (doCheck)
            {
                callInfo.Reset();
            }

            var response = HttpResponseImpl.CreateHttpResponse(request, info, result, httpRequest);

            client.Log.Debug("Got HttpResponse - executing callback.");

            try
            {
                request.Callback(response, state);

                string errorMsg;
                // and check that one of methods was called
                if (doCheck && !info.StrictModeCheck(out errorMsg))
                {
                    var infoTypeName = info.GetType().ToString();
                    client.PluginReportError(ErrorCodes.MissingCallProcessing, null, infoTypeName);
                    info.Fail(string.Format("HttpRequestCallback: {0}", errorMsg));
                }
            }
            catch (Exception ex)
            {
                client.Log.Error(ex);
                client.PluginReportError(ErrorCodes.AsyncCallbackException, ex, state);
                if (!callInfo.IsProcessed)
                {
                    callInfo.Fail(ex.ToString());
                }
            }
        }