public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            try
            {
                // we check the request contains the expected game properties
                if (!info.Request.Properties.ContainsKey("EventSize") || !info.Request.Properties.ContainsKey("Interval"))
                {
                    info.Fail("Mising GameProperties in Request: EventSize or Interval");
                }

                if (this.timer != null)
                {
                    this.PluginHost.StopTimer(this.timer);
                    this.timer = null;
                }

                var properties = info.Request.Properties;
                this.SetTimer(properties);

                base.OnSetProperties(info);
            }
            catch (Exception ex)
            {
                info.Fail(this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + ex.Message);
            }
        }
Exemplo n.º 2
0
        public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            base.OnSetProperties(info);

            var setPropertiesRequest = info.Request;
            var url = this.gamePropertiesUrl;

            if (setPropertiesRequest.HttpForward && !string.IsNullOrEmpty(url))
            {
                var state = WebFlags.ShouldSendState(info.Request.WebFlags) ? this.GetGameState() : null;

                this.PostJsonRequest(
                    url,
                    new WebhooksRequest
                {
                    Type        = info.Request.ActorNumber == 0 ? "Game" : "Actor",
                    TargetActor = info.Request.ActorNumber == 0 ? null : (int?)info.Request.ActorNumber,
                    GameId      = this.PluginHost.GameId,
                    AppId       = this.AppId,
                    AppVersion  = this.AppVersion,
                    Region      = this.Region,
                    UserId      = info.UserId,
                    Nickname    = info.Nickname,
                    ActorNr     = info.ActorNr,
                    Properties  = setPropertiesRequest.Properties,
                    State       = state,
                    AuthCookie  = WebFlags.ShouldSendAuthCookie(info.Request.WebFlags) ? info.AuthCookie : null,
                },
                    this.LogIfFailedCallback,
                    null,
                    callAsync: !WebFlags.ShouldSendSync(info.Request.WebFlags));
            }
        }
 public override void OnSetProperties(ISetPropertiesCallInfo info)
 {
     if (!this.PluginHost.GameId.EndsWith("OnSetPropertiesForgotCall"))
     {
         base.OnSetProperties(info);
     }
 }
        public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            try
            {
                // we check the request contains the expected game properties
                if (!info.Request.Properties.ContainsKey("EventSize") || !info.Request.Properties.ContainsKey("Interval"))
                {
                    info.Fail("Mising GameProperties in Request: EventSize or Interval");
                }

                if (timer != null)
                {
                    this.PluginHost.StopTimer(timer);
                    timer = null;
                }

                var properties = info.Request.Properties;
                this.SetTimer(properties);

                base.OnSetProperties(info);
            }
            catch (Exception ex)
            {
                info.Fail(this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + ex.Message);
            }
        }
Exemplo n.º 5
0
        public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            Loger.LogTagFormat(Loger.TagPlugin, "OnSetProperties===============BEGIN");
            Loger.LogTagFormat(Loger.TagPlugin, info.ToStr());

            base.OnSetProperties(info);
            Loger.LogTagFormat(Loger.TagPlugin, "OnSetProperties---------------END");
        }
        private string CheckAfterOnSetProperties(ISetPropertiesCallInfo info)
        {
            var value = (string)info.Request.Properties["ActorProperty"];

            if (value == "BeforeSetPropertiesPostCheckFail")
            {
                return("OnSetPropertiesPostCheckFail is set. we fail");
            }
            return(string.Empty);
        }
Exemplo n.º 7
0
 public void OnSetProperties(ISetPropertiesCallInfo info)
 {
     try
     {
         this.Plugin.OnSetProperties(info);
         this.StrictModeCheck(info);
     }
     catch (Exception e)
     {
         this.ExceptionHanlder(info, e);
     }
 }
Exemplo n.º 8
0
        public static string ToStr(this ISetPropertiesCallInfo info)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine("ISetPropertiesCallInfo =========== BEGIN");
            builder.AppendLine(string.Format("ISetPropertiesCallInfo.ActorNr={0}", info.ActorNr));
            builder.AppendLine(((ITypedCallInfo <ISetPropertiesRequest>)info).ToStr <ISetPropertiesRequest>());
            builder.AppendLine(((ICallInfo)info).ToStr());

            builder.AppendLine("ISetPropertiesCallInfo ----------- END");
            return(builder.ToString());
        }
Exemplo n.º 9
0
 /// <summary>
 /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeSetProperties"/>.
 /// </summary>
 /// <param name="info">Data passed in the callback call.</param>
 void IGamePlugin.OnSetProperties(ISetPropertiesCallInfo info)
 {
     try
     {
         this.OnSetProperties(info);
         this.StrictModeCheck(info);
     }
     catch (Exception e)
     {
         ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e);
         CallFailSafe(info, e.ToString());
     }
 }
Exemplo n.º 10
0
        public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            var res = this.CheckBeforeOnSetProperties(info);

            if (!string.IsNullOrEmpty(res))
            {
                info.Fail(res);
                return;
            }
            try
            {
                base.OnSetProperties(info);
            }
            catch (Exception e)
            {
                this.PluginHost.BroadcastErrorInfoEvent(e.ToString(), info);
                return;
            }
            res = this.CheckAfterOnSetProperties(info);
            if (!string.IsNullOrEmpty(res))
            {
                this.PluginHost.BroadcastErrorInfoEvent(res, info);
            }
        }
Exemplo n.º 11
0
        public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            ++this.CallsCount;

            try
            {
                this.CheckISetPropertiesCallInfo(info);
                this.CheckBeforeOnSetProperties();
            }
            catch (Exception e)
            {
                info.Fail(e.ToString());
                return;
            }
            try
            {
                base.OnSetProperties(info);
                this.CheckAfterOnSetProperties();
            }
            catch (Exception e)
            {
                this.PluginHost.BroadcastErrorInfoEvent(e.ToString(), info);
            }
        }
Exemplo n.º 12
0
 public override void OnSetProperties(ISetPropertiesCallInfo info)
 {
     this.MethodBody(info, MethodBase.GetCurrentMethod().Name);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Calls info.Fail
 /// </summary>
 /// <param name="info"></param>
 public void OnSetProperties(ISetPropertiesCallInfo info)
 {
     info.Fail(this.errorMsg);
 }
Exemplo n.º 14
0
 public override void OnSetProperties(ISetPropertiesCallInfo info)
 {
     this.onSetPropertiesEvent.Set();
     info.Continue();
 }
Exemplo n.º 15
0
        public override void OnSetProperties(ISetPropertiesCallInfo info)
        {
            base.OnSetProperties(info);

            var setPropertiesRequest = info.Request;
            var url = this.gamePropertiesUrl;

            if (setPropertiesRequest.HttpForward && !string.IsNullOrEmpty(url))
            {
                var state = WebFlags.ShouldSendState(info.Request.WebFlags) ? this.GetGameState() : null;

                this.PostJsonRequest(
                    url,
                    new WebhooksRequest
                    {
                        Type = info.Request.ActorNumber == 0 ? "Game" : "Actor",
                        TargetActor = info.Request.ActorNumber == 0 ? null : (int?)info.Request.ActorNumber,
                        GameId = this.PluginHost.GameId,
                        AppId = this.AppId,
                        AppVersion = this.AppVersion,
                        Region = this.Region,
                        UserId = info.UserId,
                        Nickname = info.Nickname,
                        ActorNr = info.ActorNr,
                        Properties = setPropertiesRequest.Properties,
                        State = state,
                        AuthCookie = WebFlags.ShouldSendAuthCookie(info.Request.WebFlags) ? info.AuthCookie : null,
                    },
                    this.LogIfFailedCallback,
                    null,
                    callAsync: !WebFlags.ShouldSendSync(info.Request.WebFlags));
            }
        }
Exemplo n.º 16
0
 public override void OnSetProperties(ISetPropertiesCallInfo info)
 {
     base.OnSetProperties(info);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Calls info.Fail
 /// </summary>
 /// <param name="info"></param>
 public void OnSetProperties(ISetPropertiesCallInfo info)
 {
     info.Fail(this.errorMsg);
 }
 public override void OnSetProperties(ISetPropertiesCallInfo info)
 {
     if (!this.PluginHost.GameId.EndsWith("OnSetPropertiesForgotCall"))
     {
         base.OnSetProperties(info);
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeSetProperties"/>.
 /// </summary>
 /// <param name="info">Data passed in the callback call.</param>
 void IGamePlugin.OnSetProperties(ISetPropertiesCallInfo info)
 {
     this.OnSetProperties(info);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Calls info.Continue(). Override to change.
 /// </summary>
 /// <param name="info">Data passed in the callback call.</param>
 public virtual void OnSetProperties(ISetPropertiesCallInfo info)
 {
     System.Diagnostics.Debug.Assert(this.PluginHost != null);
     info.Continue();
 }
Exemplo n.º 21
0
 /// <summary>
 /// Calls info.Continue(). Override to change.
 /// </summary>
 /// <param name="info">Data passed in the callback call.</param>
 public virtual void OnSetProperties(ISetPropertiesCallInfo info)
 {
     System.Diagnostics.Debug.Assert(this.PluginHost != null);
     info.Continue();
 }
Exemplo n.º 22
0
 private void CheckISetPropertiesCallInfo(ISetPropertiesCallInfo info)
 {
     this.CheckBaseInfo(info);
     Console.Write(info.ActorNr);
     CheckISetPropertiesRequest(info.Request);
 }
Exemplo n.º 23
0
 public override void OnSetProperties(ISetPropertiesCallInfo info)
 {
     this.onSetPropertiesEvent.Set();
     info.Continue();
 }
Exemplo n.º 24
0
 /// <summary>
 /// Plugin callback called when info.Continue() is called inside <see cref="IGamePlugin.BeforeSetProperties"/>.
 /// </summary>
 /// <param name="info">Data passed in the callback call.</param>
 void IGamePlugin.OnSetProperties(ISetPropertiesCallInfo info)
 {
     try
     {
         this.OnSetProperties(info);
         this.StrictModeCheck(info);
     }
     catch (Exception e)
     {
         ((IGamePlugin)this).ReportError(ErrorCodes.UnhandledException, e);
         CallFailSafe(info, e.ToString());
     }
 }