示例#1
0
 private void AddConversationTimeout(SECSEventType eventtype, SECSTransaction trans, SECSErrors err)
 {
     if (eventtype == SECSEventType.SecondarySent && err == SECSErrors.None && trans != null && trans.Secondary != null)
     {
         string str = string.Format("S{0}F{1}", trans.Secondary.Stream, trans.Secondary.Function);
         if (this.conversactionConfigure.ContainsKey(str))
         {
             if (str == "S3F12")
             {
                 if (trans.Secondary.Root.Item(2).IsEmpty)
                 {
                     return;
                 }
                 if ((int)trans.Secondary.Root.Item(2).Value != 2)
                 {
                     return;
                 }
             }
             else
             {
                 if (trans.Secondary.Root.IsEmpty)
                 {
                     return;
                 }
                 if ((int)trans.Secondary.Root.Value != 0)
                 {
                     return;
                 }
             }
             SECSS9FxMonitor.ConversactionItem item = new SECSS9FxMonitor.ConversactionItem
             {
                 Transaction1 = this.conversactionConfigure[str].Transaction1,
                 Transaction2 = this.conversactionConfigure[str].Transaction2,
                 Transaction  = trans
             };
             try
             {
                 item.EDID = trans.Primary.Root.Item(1).Value.ToString();
                 item.EDID = this.conversactionConfigure[str].EDID + ": " + item.EDID;
             }
             catch (Exception)
             {
                 item.EDID = this.conversactionConfigure[str].EDID;
             }
             lock (this.syncConversation)
             {
                 item.DeadLine = DateTime.Now.AddSeconds(45.0);
                 this.conversationList.Add(item);
             }
         }
     }
 }
示例#2
0
        private void CheckConversationTimeout()
        {
            List <int> list = new List <int>();

            for (int i = 0; i < this.conversationList.Count; i++)
            {
                if (this.conversationList[i].DeadLine < DateTime.Now)
                {
                    list.Add(i);
                }
            }
            foreach (int num2 in list)
            {
                SECSS9FxMonitor.ConversactionItem item = this.conversationList[num2];
                this.conversationList.RemoveAt(num2);
                SECSTransaction trans = this.secsPort.Library.FindTransaction("S9F13");
                trans.Primary.Root.Item(1).Value = item.Transaction2Str;
                trans.Primary.Root.Item(2).Value = item.EDID;
                this.secsPort.Send(trans);
                this.secsPort.CallSECSEvent(SECSEventType.Error, item.Transaction, SECSErrors.ConversationTimeout, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.ConversationTimeout));
            }
        }