Esempio n. 1
0
 private static void CallFailSafe(ICallInfo info, string errorMessage)
 {
     if (!info.IsProcessed)
     {
         info.Fail(errorMessage);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Check if any of the processing method was called for the passed ICallInfo argument.
 /// </summary>
 /// <param name="callInfo"></param>
 protected virtual void StrictModeCheck(ICallInfo callInfo)
 {
     if (this.UseStrictMode && callInfo.IsNew)
     {
         var infoTypeName = callInfo.GetType().ToString();
         ((IGamePlugin)this).ReportError(Photon.Hive.Plugin.ErrorCodes.MissingCallProcessing, null, infoTypeName);
         callInfo.Fail(string.Format("none of {0}'s method were called", infoTypeName));
     }
 }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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());
                }
            }
        }
Esempio n. 5
0
 private static void CallFailSafe(ICallInfo info, string errorMessage)
 {
     if (!info.IsProcessed)
     {
         info.Fail(errorMessage);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Check if any of the processing method was called for the passed ICallInfo argument.
 /// </summary>
 /// <param name="callInfo"></param>
 protected virtual void StrictModeCheck(ICallInfo callInfo)
 {
     if (this.UseStrictMode && callInfo.IsNew)
     {
         var infoTypeName = callInfo.GetType().ToString();
         ((IGamePlugin)this).ReportError(Photon.Hive.Plugin.ErrorCodes.MissingCallProcessing, null, infoTypeName);
         callInfo.Fail(string.Format("none of {0}'s method were called", infoTypeName));
     }
 }