Commit ee7b5c46 authored by shaxuezheng's avatar shaxuezheng

增加控制部分

parent 819bd750
......@@ -37,20 +37,31 @@ namespace ModbusDemo.windows
writer = new StreamWriter(fileStream);
}
writer.WriteLine(DateTime.Now + ": " + info);
}
finally
catch (Exception e)
{
if (writer != null)
{
if (writer != null)
{
writer.Close();
writer.Dispose();
fileStream.Close();
fileStream.Dispose();
}
writer.Close();
writer.Dispose();
fileStream.Close();
fileStream.Dispose();
}
throw;
}
finally
{
if (writer != null)
{
writer.Close();
writer.Dispose();
fileStream.Close();
fileStream.Dispose();
}
}
}
public void CreateDirectory(string infoPath)
{
DirectoryInfo directoryInfo = Directory.GetParent(infoPath);
......
......@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace ModbusDemo
{
class startAddress
......@@ -95,10 +95,44 @@ namespace ModbusDemo
}
public List<Ss> ss { get; set; }
}
public class Ctrl2
{
public string taskId;
public void settaskId(string taskId)
{
this.taskId = taskId;
}
public string gettaskId()
{
return taskId;
}
public List<Sss> ss { get; set;}
}
public class Sss
{
public byte addr;
private Hashtable dn = new Hashtable();
public Hashtable op
{ get => dn; set => dn = value; }
public void setAddr(byte addr)
{
this.addr = addr;
}
public byte getAddr()
{
return addr;
}
}
public class Op
{
public int duration;
public long startTime;
public int d0
{
get => D0;
......@@ -168,6 +202,7 @@ namespace ModbusDemo
{
public byte addr;
public Op op;
public void setAddr(byte addr)
{
this.addr = addr;
......@@ -176,7 +211,6 @@ namespace ModbusDemo
{
return addr;
}
public void setOp(Op op)
{
this.op = op;
......@@ -185,6 +219,5 @@ namespace ModbusDemo
{
return op;
}
}
}
......@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace ModbusDemo.windows
{
class TransferPool
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment