Exemplo n.º 1
0
        public void AppendMessage(CommMessage msg)
        {
            Logger.LogInfo(this, "AppendMessage() msg:'{0}'", msg.GetComponentName());

            byte[] writeByte = msg.ToByteArray();
            string fileName  = EventFilePath + msg.GetMessageTimestamp();

            Logger.LogDebug(this, "Writing '{0}' bytes in file '{1}'", writeByte.Length, fileName);
            File.WriteAllBytes(fileName + ".TMP", writeByte);
            Logger.LogDebug(this, "rename temp file '{0}' to '{1}'", fileName + ".TMP", fileName + ".BIN");
            File.Move(fileName + ".TMP", fileName + ".BIN");
        }
 public MessageRecord(CommMessage msg)
 {
     SourceIP         = msg.GetSourceIP();
     ComponentName    = msg.GetComponentName();
     MessageCommand   = msg.GetMessageCommand();
     MessageTimestamp = msg.GetMessageTimestamp();
     IsBinary         = msg.GetIsBinary();
     if (IsBinary)
     {
         DataBinary = new byte[msg.GetDataSize()];
         msg.Data.CopyTo(DataBinary, 0);
     }
     else
     {
         DataString = msg.GetDataString();
     }
 }