using System;
using System.Text;
// ReSharper disable InconsistentNaming
namespace DTS.DASLib.Command
{
///
/// this is an abstraction of the LogEntryBase classes, I extracted the common
/// functionality and put it here
/// this class in turn is used by SliceCommandLogEntry and CommonLogEntry(ribeye)
/// the reason for the additional classes is the structure of the packets and how the log looks
/// differs slightly between ribeye and slice
/// I'm not sure these classes are in use?
/// 6/14/2010 - dtm
///
public abstract class CommandLogEntryBase
{
protected StringBuilder sb;
protected CommandPacketBase command;
///
/// construct a CommandLogEntryBase object
///
/// underlying command
public CommandLogEntryBase(CommandPacketBase _command)
{
sb = new StringBuilder();
command = _command;
sb.AppendFormat("=== {0:08d} ==={1}", _command.SequenceNumber, Environment.NewLine);
}
///
/// adds command data into log
///
///
public void TagCommonCommandData(string CommandName)
{
sb.AppendFormat("Log Entry Type:\t\t{0} command{1}", CommandName, Environment.NewLine);
}
///
/// adds response data into log
///
///
public void TagCommonResponseData(string CommandName)
{
sb.AppendFormat("Response Status:\t\t{0}{1}", command.Status, Environment.NewLine);
sb.AppendFormat("Response Timestamp:\t{0} {1}{2}", DateTime.Now.ToShortDateString(),
DateTime.Now.ToLongTimeString(), Environment.NewLine);
}
///
/// returns the log entry represented as a string
///
///
public override string ToString()
{
return sb.ToString();
}
}
}