Touch-ups on autoreconnect

This commit is contained in:
Heath Volmer
2016-11-10 12:26:45 -07:00
parent 9553dac99c
commit c92c2e6df4
8 changed files with 27 additions and 6 deletions

View File

@@ -32,6 +32,12 @@ namespace PepperDash.Core
/// </summary>
public IBasicCommunication Port { get; private set; }
/// <summary>
/// Default false. If true, the delimiter will be included in the line output
/// events
/// </summary>
public bool IncludeDelimiter { get; set; }
/// <summary>
/// For receive buffer
/// </summary>
@@ -92,7 +98,14 @@ namespace PepperDash.Core
if (lines.Length > 0)
{
for (int i = 0; i < lines.Length - 1; i++)
handler(this, new GenericCommMethodReceiveTextArgs(lines[i]));
{
string strToSend = null;
if (IncludeDelimiter)
strToSend = lines[i] + Delimiter;
else
strToSend = lines[i];
handler(this, new GenericCommMethodReceiveTextArgs(strToSend));
}
ReceiveBuffer = new StringBuilder(lines[lines.Length - 1]);
}
}
@@ -117,7 +130,14 @@ namespace PepperDash.Core
if (lines.Length > 1)
{
for (int i = 0; i < lines.Length - 1; i++)
handler(this, new GenericCommMethodReceiveTextArgs(lines[i]));
{
string strToSend = null;
if (IncludeDelimiter)
strToSend = lines[i] + StringDelimiter;
else
strToSend = lines[i];
handler(this, new GenericCommMethodReceiveTextArgs(strToSend));
}
ReceiveBuffer = new StringBuilder(lines[lines.Length - 1]);
}
}