void SerialPortObject_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         if (IsConnected)
         {
             //可以接收
             QueueObject qo = new QueueObject();
             qo.Buffer     = new byte[SerialPortObject.BytesToRead];
             qo.DataLength = SerialPortObject.Read(qo.Buffer, 0, qo.Buffer.Length);
             if (qo.DataLength > 0 && qo.Buffer.Length >= 1)
             {
                 BufferStream.AddRangeWithLock(qo.Buffer);
                 IMessageEntity msg = MessageDataAdapterObject.Resolve();
                 if (msg != null)
                 {
                     OnMessageReceived(new MessageReceivedEventArgs(msg));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.ToString(), ex);
     }
 }
 void SerialPortObject_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         if (IsConnected)
         {
             //可以接收
             QueueObject qo = new QueueObject();
             qo.Buffer     = new byte[SerialPortObject.BytesToRead];
             qo.DataLength = SerialPortObject.Read(qo.Buffer, 0, qo.Buffer.Length);
             if (qo.DataLength > 0 && qo.Buffer.Length >= 1)
             {
                 BufferStream.AddRangeWithLock(qo.Buffer);
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.ToString(), ex);
     }
 }