Merge remote-tracking branch 'origin/master'

master
杨威 1 month ago
commit fe7ea9531f

@ -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

@ -1,40 +0,0 @@
namespace NDSD_Screwdriver
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
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
}
}

@ -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();
}
}
}

@ -7,7 +7,7 @@
<ProjectGuid>{2448106D-4FBA-4E8F-83B7-3C727C4A4ECE}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>NDSD_Screwdriver</RootNamespace>
<AssemblyName>NDSD-Screwdriver</AssemblyName>
<AssemblyName>NDSD_Screwdriver</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -46,14 +46,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScrewdriverTest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="ScrewdriverTest.Designer.cs">
<DependentUpon>ScrewdriverTest.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -63,6 +63,9 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="ScrewdriverTest.resx">
<DependentUpon>ScrewdriverTest.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -76,5 +79,11 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NDSD-TouchSocket\NDSD_TouchSocket.csproj">
<Project>{B2580256-9ED8-4985-BE38-3F771B13E9FD}</Project>
<Name>NDSD_TouchSocket</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -16,7 +16,7 @@ namespace NDSD_Screwdriver
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new ScrewdriverTest());
}
}
}

@ -0,0 +1,110 @@
namespace NDSD_Screwdriver
{
partial class ScrewdriverTest
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

@ -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)
{
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -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));
}
}

@ -8,7 +8,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NDSD_TouchSocket</RootNamespace>
<AssemblyName>NDSD-TouchSocket</AssemblyName>
<AssemblyName>NDSD_TouchSocket</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>

@ -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)

Loading…
Cancel
Save