Exemplo n.º 1
0
        private void VerimatrixTcpSender_BeforeSending(object sender, TcpSenderEventArgs e)
        {
            ISendLogHandler sendLog = new VerimatrixLogHandler();

            if (IsRegistered && IsConnected)
            {
                //con current dic check expire
                VerimatrixMessageDataAccess.Inspection(tcpSenderParameter.Timeout);

                if (!this.IsSendingHoldShutdownCommand(e.Request))
                {
                    VerimatrixMessageDataAccess.LogRequestMessage(e.Request, this.GetLogEntity(e.Request));

                    this.LogSendMessage(sendLog.GetSendLog(e.Request, this.GetHostName(), this.CommandName));

                    //Logger.Info(string.Format("Message sent: {0}", e.Request));
                }
                else
                {
                    //hold & shutdown
                    this.WriteLog(sendLog.GetConnectionLog(e.Request, this.GetHostName(), this.CommandName));
                }
            }
            else
            {
                //register
                this.WriteLog(sendLog.GetConnectionLog(e.Request, this.GetHostName(), this.CommandName));
            }
        }
Exemplo n.º 2
0
        private void VerimatrixTcpSender_SendHoldCommand(object sender, TcpSenderEventArgs e)
        {
            if (IsRegistered)
            {
                var holdCommand = string.Format("{0},{1}\n", this.senderParameter.HoldCommandMsgNumber, this.senderParameter.HoldCommandName);

                base.Send(holdCommand);
            }
        }
Exemplo n.º 3
0
        private void VerimatrixTcpSender_AfterReceived(object sender, TcpSenderEventArgs e)
        {
            Func <string, List <string> > SplitReceivedMessage = delegate(string tMessage)
            {
                return(tMessage.Split(new char[] { VerimatrixConstants.RESPONSEEND }, StringSplitOptions.RemoveEmptyEntries).ToList());
            };

            var rMessages = SplitReceivedMessage(e.Respose);

            rMessages.ForEach((Response) =>
            {
                ProcessMessage(Response);
            });
        }
Exemplo n.º 4
0
 private void VerimatrixTcpSender_Reconnected(object sender, TcpSenderEventArgs e)
 {
     SendRegisterCommand();
     if (IsRegistered | registerWaitHandler.WaitOne(tcpSenderParameter.Timeout))
     {
         if (!IsRegistered)
         {
             base.Dispose();
             throw new Exception("Registration message returns error");
         }
     }
     else
     {
         base.Dispose();
         throw new IntegrationException(string.Format("Registration failed with timeout ({0} ms)", tcpSenderParameter.Timeout));
     }
 }