Commit ee7b5c46 authored by shaxuezheng's avatar shaxuezheng

增加控制部分

parent 819bd750
...@@ -37,20 +37,31 @@ namespace ModbusDemo.windows ...@@ -37,20 +37,31 @@ namespace ModbusDemo.windows
writer = new StreamWriter(fileStream); writer = new StreamWriter(fileStream);
} }
writer.WriteLine(DateTime.Now + ": " + info); writer.WriteLine(DateTime.Now + ": " + info);
} }
finally catch (Exception e)
{
if (writer != null)
{ {
if (writer != null) writer.Close();
{ writer.Dispose();
writer.Close(); fileStream.Close();
writer.Dispose(); fileStream.Dispose();
fileStream.Close(); }
fileStream.Dispose(); throw;
} }
finally
{
if (writer != null)
{
writer.Close();
writer.Dispose();
fileStream.Close();
fileStream.Dispose();
} }
} }
}
public void CreateDirectory(string infoPath) public void CreateDirectory(string infoPath)
{ {
DirectoryInfo directoryInfo = Directory.GetParent(infoPath); DirectoryInfo directoryInfo = Directory.GetParent(infoPath);
......
...@@ -3,7 +3,7 @@ using System.Collections.Generic; ...@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections;
namespace ModbusDemo namespace ModbusDemo
{ {
class startAddress class startAddress
...@@ -95,10 +95,44 @@ namespace ModbusDemo ...@@ -95,10 +95,44 @@ namespace ModbusDemo
} }
public List<Ss> ss { get; set; } 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 class Op
{ {
public int duration; public int duration;
public long startTime; public long startTime;
public int d0 public int d0
{ {
get => D0; get => D0;
...@@ -168,6 +202,7 @@ namespace ModbusDemo ...@@ -168,6 +202,7 @@ namespace ModbusDemo
{ {
public byte addr; public byte addr;
public Op op; public Op op;
public void setAddr(byte addr) public void setAddr(byte addr)
{ {
this.addr = addr; this.addr = addr;
...@@ -176,7 +211,6 @@ namespace ModbusDemo ...@@ -176,7 +211,6 @@ namespace ModbusDemo
{ {
return addr; return addr;
} }
public void setOp(Op op) public void setOp(Op op)
{ {
this.op = op; this.op = op;
...@@ -185,6 +219,5 @@ namespace ModbusDemo ...@@ -185,6 +219,5 @@ namespace ModbusDemo
{ {
return op; return op;
} }
} }
} }
...@@ -4,6 +4,7 @@ using System.Linq; ...@@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
namespace ModbusDemo.windows namespace ModbusDemo.windows
{ {
class TransferPool 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