private void Run_Click(object sender, EventArgs e)
{
BP_RESPONSE response = BP_RESPONSE.Disconnect;
if (bpPort != null && bpPort.IsConnected)
{
string script = Script.Text.Trim();
foreach (string line in script.Split(new char[] { '\r', '\n' }))
{
string cmd = line.Trim();
if (!string.IsNullOrEmpty(cmd))
{
int idx = cmd.IndexOf("//");
if (idx >= 0)
cmd = cmd.Substring(0, idx).Trim();
foreach (string subline in cmd.Split(new char[] { '\'' }))
{
string subcmd = subline.Trim();
if (!string.IsNullOrEmpty(subcmd))
{
response = bpPort.SendWait(subcmd);
if (response != BP_RESPONSE.OK)
break;
}
}
}
}
}
DisplayStatus(response);
}