Пример #1
0
        protected override IFreeformEntity_MsgTgt CreateFreeformTarget(IMonitorEntity parent, IMonitorEntity_MsgTgt request)
        {
            using (ILogMethod method = Log.LogMethod("MonTgtParser_PC_ApproachingNotificationMessage_H2G", "CreateMonitorTarget"))
            {
                try
                {
                    MonTgt_H2G_PC_ApproachingNotificationMessage monTgt = request as MonTgt_H2G_PC_ApproachingNotificationMessage;
                    if (monTgt == null)
                    {
                        return(null);
                    }

                    FFTgt_H2G_PC_ApproachingNotificationMessage ffTgt = new FFTgt_H2G_PC_ApproachingNotificationMessage()
                    {
                        DisplayTime          = monTgt.DisplayTime,
                        DisplayInterval      = monTgt.DisplayInterval,
                        HandlePulls          = monTgt.HandlePulls,
                        RatingInterval       = monTgt.RatingInterval,
                        DisplayMessageLength = monTgt.DisplayMessageLength,
                        DisplayMessage       = monTgt.DisplayMessage
                    };
                    return(ffTgt);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                    return(null);
                }
            }
        }
        /// <summary>
        /// To create Approach Limit Monitor message from response string
        /// </summary>
        /// <param name="strResponse"></param>
        /// <returns></returns>
        public MonTgt_H2G_PC_ApproachingNotificationMessage GetApproachLimitMessage(string strResponse)
        {
            try
            {
                MonTgt_H2G_PC_ApproachingNotificationMessage montgtApproachLimit = new MonTgt_H2G_PC_ApproachingNotificationMessage();

                if (HandlerHelper.Current.IsExtendedPlayer)
                {
                    montgtApproachLimit.DisplayTime = Convert.ToInt16(strResponse.Substring(50, 4));
                    montgtApproachLimit.DisplayInterval = Convert.ToInt16(strResponse.Substring(54, 4));

                    montgtApproachLimit.HandlePulls = Convert.ToInt16(strResponse.Substring(196, 4));
                    montgtApproachLimit.RatingInterval = Convert.ToInt16(strResponse.Substring(200, 4));
                }
                else
                {
                    montgtApproachLimit.DisplayTime = Convert.ToInt16(strResponse.Substring(48, 4));
                    montgtApproachLimit.DisplayInterval = Convert.ToInt16(strResponse.Substring(52, 4));

                    montgtApproachLimit.HandlePulls = Convert.ToInt16(strResponse.Substring(194, 4));
                    montgtApproachLimit.RatingInterval = Convert.ToInt16(strResponse.Substring(198, 4));
                }

                montgtApproachLimit.DisplayMessage = GetDisplayMessageForApproachLimit(strResponse);
                montgtApproachLimit.DisplayMessageLength = montgtApproachLimit.DisplayMessage.Length;
                return montgtApproachLimit;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return new MonTgt_H2G_PC_ApproachingNotificationMessage();
            }
        }