first commit
This commit is contained in:
43
ChamChat/Models/DataTransferLog.cs
Normal file
43
ChamChat/Models/DataTransferLog.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChamChat.Models
|
||||
{
|
||||
public class DataTransferLog
|
||||
{
|
||||
|
||||
public DataTransferLog(String Command, String ReturnData, Interface IF)
|
||||
{
|
||||
_Command = Command.Trim();
|
||||
_ReturnData = ReturnData.Trim();
|
||||
_Interface = IF;
|
||||
_Timestamp = DateTime.Now;
|
||||
}
|
||||
|
||||
private Boolean _ShowInGUI = true; public Boolean ShowInGUI { get { return _ShowInGUI; } set { _ShowInGUI = value; } }
|
||||
|
||||
|
||||
private string _Command; public String Command { get { return _Command; } set { _Command = value; } }
|
||||
private string _ReturnData; public String ReturnData { get { return _ReturnData; } set { _ReturnData = value; } }
|
||||
private Interface _Interface; public Interface InterfaceID { get { return _Interface; } }
|
||||
private DateTime _Timestamp; public DateTime Timestamp { get { return _Timestamp; } }
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
DateTime d = _Timestamp;
|
||||
string sTimestamp = String.Format("{0:0000}-{1:00}-{2:00} @ {3:00}:{4:00}:{5:00}.{6:000}", d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, d.Millisecond);
|
||||
return String.Format("{0} : Tx '{1}', Rx '{2}'", sTimestamp, _Command, _ReturnData).Trim().Replace(Environment.NewLine, "");
|
||||
}
|
||||
|
||||
public string ToCSV()
|
||||
{
|
||||
DateTime d = _Timestamp;
|
||||
//string sTimestamp = String.Format("{0:0000}-{1:00}-{2:00} @ {3:00}:{4:00}:{5:00}.{6:000}", d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, d.Millisecond);
|
||||
string sTimestamp = String.Format("{1:00}-{2:00} @ {3:00}:{4:00}:{5:00}.{6:000}", d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, d.Millisecond);
|
||||
return String.Format("{0}; {1}; {2}", sTimestamp, _Command, _ReturnData).Trim().Replace(Environment.NewLine,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user