Esempio n. 1
0
        private void MsgCallBack(MsgInformationEx MsgDTO)
        {
            Task.Factory.StartNew(() =>
            {
                try
                {
                    var bindAi = RestrictorSvc.AllocateBindAi(MsgDTO);
                    IEnumerable <AIBase> groups;
                    if (string.IsNullOrEmpty(bindAi))
                    {
                        groups = AIGroup.Where(p => (int)p.PriorityLevel >= (int)AIPriority.System);
                    }
                    else
                    {
                        MsgDTO.BindAi = bindAi;
                        groups        = AIGroup;
                    }

                    foreach (var ai in groups)
                    {
                        if (ai.OnMsgReceived(MsgDTO))
                        {
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                }
            });
        }
Esempio n. 2
0
        public bool SysPressure(MsgInformationEx MsgDTO, object[] param)
        {
            var msg = string.Join("\r\n",
                                  RestrictorSvc.Pressures.Select(p => $"{p.Key}:{p.Value}/{RestrictorSvc.BindAiLimit[p.Key]}{(RestrictorSvc.IsTooFreq(p.Key) ? "(危)" : string.Empty)}"));

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }