diff --git a/NDSD-Screwdriver.sln b/NDSD-Screwdriver.sln index df2526f..2e9c66e 100644 --- a/NDSD-Screwdriver.sln +++ b/NDSD-Screwdriver.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.10.35122.118 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDSD-Screwdriver", "NDSD-Screwdriver\NDSD-Screwdriver.csproj", "{2448106D-4FBA-4E8F-83B7-3C727C4A4ECE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDSD_Screwdriver", "NDSD-Screwdriver\NDSD_Screwdriver.csproj", "{2448106D-4FBA-4E8F-83B7-3C727C4A4ECE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDSD-TouchSocket", "NDSD-TouchSocket\NDSD-TouchSocket.csproj", "{B2580256-9ED8-4985-BE38-3F771B13E9FD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDSD_TouchSocket", "NDSD-TouchSocket\NDSD_TouchSocket.csproj", "{B2580256-9ED8-4985-BE38-3F771B13E9FD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/NDSD-Screwdriver/Form1.Designer.cs b/NDSD-Screwdriver/Form1.Designer.cs deleted file mode 100644 index a05d7b7..0000000 --- a/NDSD-Screwdriver/Form1.Designer.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace NDSD_Screwdriver -{ - partial class Form1 - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要修改 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} - diff --git a/NDSD-Screwdriver/Form1.cs b/NDSD-Screwdriver/Form1.cs deleted file mode 100644 index 7e21f37..0000000 --- a/NDSD-Screwdriver/Form1.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace NDSD_Screwdriver -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/NDSD-Screwdriver/NDSD-Screwdriver.csproj b/NDSD-Screwdriver/NDSD_Screwdriver.csproj similarity index 84% rename from NDSD-Screwdriver/NDSD-Screwdriver.csproj rename to NDSD-Screwdriver/NDSD_Screwdriver.csproj index 23a5c02..91b319d 100644 --- a/NDSD-Screwdriver/NDSD-Screwdriver.csproj +++ b/NDSD-Screwdriver/NDSD_Screwdriver.csproj @@ -7,7 +7,7 @@ {2448106D-4FBA-4E8F-83B7-3C727C4A4ECE} WinExe NDSD_Screwdriver - NDSD-Screwdriver + NDSD_Screwdriver v4.8 512 true @@ -46,14 +46,14 @@ - + + + Form - - Form1.cs + + ScrewdriverTest.cs - - ResXFileCodeGenerator Resources.Designer.cs @@ -63,6 +63,9 @@ True Resources.resx + + ScrewdriverTest.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -76,5 +79,11 @@ + + + {B2580256-9ED8-4985-BE38-3F771B13E9FD} + NDSD_TouchSocket + + \ No newline at end of file diff --git a/NDSD-Screwdriver/Program.cs b/NDSD-Screwdriver/Program.cs index 0ca9a55..a89d5fe 100644 --- a/NDSD-Screwdriver/Program.cs +++ b/NDSD-Screwdriver/Program.cs @@ -16,7 +16,7 @@ namespace NDSD_Screwdriver { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new ScrewdriverTest()); } } } diff --git a/NDSD-Screwdriver/ScrewdriverTest.Designer.cs b/NDSD-Screwdriver/ScrewdriverTest.Designer.cs new file mode 100644 index 0000000..fc5b61c --- /dev/null +++ b/NDSD-Screwdriver/ScrewdriverTest.Designer.cs @@ -0,0 +1,110 @@ +namespace NDSD_Screwdriver +{ + partial class ScrewdriverTest + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.DOpenButton = new System.Windows.Forms.Button(); + this.DCloseButton = new System.Windows.Forms.Button(); + this.DNoTextBox = new System.Windows.Forms.TextBox(); + this.DOpenAll = new System.Windows.Forms.Button(); + this.DCloseAll = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // DOpenButton + // + this.DOpenButton.Location = new System.Drawing.Point(12, 43); + this.DOpenButton.Name = "DOpenButton"; + this.DOpenButton.Size = new System.Drawing.Size(100, 30); + this.DOpenButton.TabIndex = 0; + this.DOpenButton.Text = "开启"; + this.DOpenButton.UseVisualStyleBackColor = true; + this.DOpenButton.Click += new System.EventHandler(this.DOpenButton_Click); + // + // DCloseButton + // + this.DCloseButton.Location = new System.Drawing.Point(12, 79); + this.DCloseButton.Name = "DCloseButton"; + this.DCloseButton.Size = new System.Drawing.Size(100, 30); + this.DCloseButton.TabIndex = 1; + this.DCloseButton.Text = "关闭"; + this.DCloseButton.UseVisualStyleBackColor = true; + this.DCloseButton.Click += new System.EventHandler(this.DCloseButton_Click); + // + // DNoTextBox + // + this.DNoTextBox.Location = new System.Drawing.Point(12, 12); + this.DNoTextBox.Name = "DNoTextBox"; + this.DNoTextBox.Size = new System.Drawing.Size(100, 25); + this.DNoTextBox.TabIndex = 2; + // + // DOpenAll + // + this.DOpenAll.Location = new System.Drawing.Point(12, 115); + this.DOpenAll.Name = "DOpenAll"; + this.DOpenAll.Size = new System.Drawing.Size(100, 30); + this.DOpenAll.TabIndex = 3; + this.DOpenAll.Text = "全部开启"; + this.DOpenAll.UseVisualStyleBackColor = true; + this.DOpenAll.Click += new System.EventHandler(this.DOpenAll_Click); + // + // DCloseAll + // + this.DCloseAll.Location = new System.Drawing.Point(12, 151); + this.DCloseAll.Name = "DCloseAll"; + this.DCloseAll.Size = new System.Drawing.Size(100, 30); + this.DCloseAll.TabIndex = 4; + this.DCloseAll.Text = "全部关闭"; + this.DCloseAll.UseVisualStyleBackColor = true; + this.DCloseAll.Click += new System.EventHandler(this.DCloseAll_Click); + // + // ScrewdriverTest + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1296, 264); + this.Controls.Add(this.DCloseAll); + this.Controls.Add(this.DOpenAll); + this.Controls.Add(this.DNoTextBox); + this.Controls.Add(this.DCloseButton); + this.Controls.Add(this.DOpenButton); + this.Name = "ScrewdriverTest"; + this.Text = "螺丝刀测试"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button DOpenButton; + private System.Windows.Forms.Button DCloseButton; + private System.Windows.Forms.TextBox DNoTextBox; + private System.Windows.Forms.Button DOpenAll; + private System.Windows.Forms.Button DCloseAll; + } +} \ No newline at end of file diff --git a/NDSD-Screwdriver/ScrewdriverTest.cs b/NDSD-Screwdriver/ScrewdriverTest.cs new file mode 100644 index 0000000..ab33ab9 --- /dev/null +++ b/NDSD-Screwdriver/ScrewdriverTest.cs @@ -0,0 +1,44 @@ +using NDSD_TouchSocket; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace NDSD_Screwdriver +{ + public partial class ScrewdriverTest : Form + { + DOperate DOperate; + + public ScrewdriverTest() + { + InitializeComponent(); + DOperate = new DOperate(); + } + + private void DOpenButton_Click(object sender, EventArgs e) + { + + } + + private void DCloseButton_Click(object sender, EventArgs e) + { + + } + + private void DCloseAll_Click(object sender, EventArgs e) + { + + } + + private void DOpenAll_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/NDSD-Screwdriver/ScrewdriverTest.resx b/NDSD-Screwdriver/ScrewdriverTest.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/NDSD-Screwdriver/ScrewdriverTest.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NDSD-TouchSocket/DOperate.cs b/NDSD-TouchSocket/DOperate.cs index 4af5833..901b123 100644 --- a/NDSD-TouchSocket/DOperate.cs +++ b/NDSD-TouchSocket/DOperate.cs @@ -10,19 +10,21 @@ namespace NDSD_TouchSocket { SendAnalysis sendAnalysis; + private static TcpServer Server = TcpServer.Instance; + public DOperate() { sendAnalysis = new SendAnalysis(); } - public byte[] DOpen(Port port) + public void DOpen(Port port) { - return sendAnalysis.DOpenDataAnalysis((byte)port); + Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)port)); } - public byte[] DClose(Port port) + public void DClose(Port port) { - return sendAnalysis.DCloseDataAnlysis((byte)port); + Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port)); } } diff --git a/NDSD-TouchSocket/NDSD-TouchSocket.csproj b/NDSD-TouchSocket/NDSD_TouchSocket.csproj similarity index 98% rename from NDSD-TouchSocket/NDSD-TouchSocket.csproj rename to NDSD-TouchSocket/NDSD_TouchSocket.csproj index 23c28e7..1c7a04b 100644 --- a/NDSD-TouchSocket/NDSD-TouchSocket.csproj +++ b/NDSD-TouchSocket/NDSD_TouchSocket.csproj @@ -8,7 +8,7 @@ Library Properties NDSD_TouchSocket - NDSD-TouchSocket + NDSD_TouchSocket v4.8 512 true diff --git a/NDSD-TouchSocket/TcpServer.cs b/NDSD-TouchSocket/TcpServer.cs index 6c0e129..5eb0d39 100644 --- a/NDSD-TouchSocket/TcpServer.cs +++ b/NDSD-TouchSocket/TcpServer.cs @@ -88,6 +88,16 @@ namespace NDSD_TouchSocket } } + public async void SendMessage(byte[] bytes) + { + //尝试性获取 + if (service.TryGetClient("192.168.0.178", out var sessionClient)) + { + await sessionClient.SendAsync(bytes); + } + return; + } + public bool Isopen() { if (service.ServerState == ServerState.None) @@ -145,16 +155,6 @@ namespace NDSD_TouchSocket } } - public async void SendMessage(byte[] bytes) - { - //尝试性获取 - if (service.TryGetClient("192.168.0.178", out var sessionClient)) - { - await sessionClient.SendAsync(bytes); - } - return; - } - private void BufferMemory(byte[] bytes) { if (bytes[4] == 0x00 && bytes[5] == 0xB9)