Commit e88c2f15 顾剑亮

上传代码

1 个父辈 cbcd77fe
正在显示 80 个修改的文件 包含 5452 行增加6 行删除
此文件类型无法预览
......@@ -5,16 +5,42 @@ VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIOBOX", "AIOBOX\AIOBOX.csproj", "{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIOBOX_old", "AIOBOX_old\AIOBOX_old.csproj", "{64600160-A389-4B09-AF59-A4C9ACA039DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIOBOX_Debug_old", "AIOBOX_Debug_old\AIOBOX_Debug_old.csproj", "{20C68949-5711-4149-B9C0-26B8EDC2B5D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Debug|x86.ActiveCfg = Debug|x86
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Debug|x86.Build.0 = Debug|x86
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Release|Any CPU.Build.0 = Release|Any CPU
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Release|x86.ActiveCfg = Release|x86
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Release|x86.Build.0 = Release|x86
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Debug|x86.ActiveCfg = Debug|x86
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Debug|x86.Build.0 = Debug|x86
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Release|Any CPU.Build.0 = Release|Any CPU
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Release|x86.ActiveCfg = Release|x86
{64600160-A389-4B09-AF59-A4C9ACA039DE}.Release|x86.Build.0 = Release|x86
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Debug|x86.ActiveCfg = Debug|x86
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Debug|x86.Build.0 = Debug|x86
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Release|Any CPU.Build.0 = Release|Any CPU
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Release|x86.ActiveCfg = Release|x86
{20C68949-5711-4149-B9C0-26B8EDC2B5D3}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -274,6 +274,7 @@ namespace Asa.IOModule
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
buff[7] = 5; //功能码
buff[9] = _addressOutput[add]; //地址
buff[10] = (byte)sta; //写入值
......@@ -376,6 +377,7 @@ namespace Asa.IOModule
try
{
_client.Send(buff);
}
catch (Exception ex)
{
......
......@@ -68,8 +68,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if not exist "C:\DLL\$(ProjectName)" md "C:\DLL\$(ProjectName)"
copy "$(TargetPath)" "C:\DLL\$(ProjectName)\$(TargetFileName)"
copy "$(TargetDir)$(TargetName).xml" "C:\DLL\$(ProjectName)\$(TargetName).xml"</PostBuildEvent>
<PostBuildEvent>copy "$(TargetPath)" "D:\OneDrive - 上海挚锦科技有限公司\DLL\AIOBOX\$(TargetFileName)"
copy "$(TargetDir)$(TargetName).xml" "D:\OneDrive - 上海挚锦科技有限公司\DLL\AIOBOX\$(TargetName).xml"</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0.6")]
[assembly: AssemblyFileVersion("2.3.0.6")]
[assembly: AssemblyVersion("2.4.0.0")]
[assembly: AssemblyFileVersion("2.4.0.0")]
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\AIOBOX.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{20C68949-5711-4149-B9C0-26B8EDC2B5D3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AIOBOX_Debug</RootNamespace>
<AssemblyName>AIOBOX_Debug</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BLL.cs" />
<Compile Include="Common.cs" />
<Compile Include="FrmIO.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmIO.Designer.cs">
<DependentUpon>FrmIO.cs</DependentUpon>
</Compile>
<Compile Include="FrmIP.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmIP.Designer.cs">
<DependentUpon>FrmIP.cs</DependentUpon>
</Compile>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmIO.resx">
<DependentUpon>FrmIO.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmIP.resx">
<DependentUpon>FrmIP.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AIOBOX_old\AIOBOX_old.csproj">
<Project>{64600160-a389-4b09-af59-a4c9aca039de}</Project>
<Name>AIOBOX_old</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Asa
{
public class InputDisplay
{
private bool _isrun;
private int _count;
private PictureBox _pic;
private RectangleF[] _rect;
private RectangleF[] _rectText;
private IOModule.Box_Sta[] _state;
private string[] _text;
private const int RADIUS = 20;
private readonly Font TEXT_FONT = new Font("Arial", 14f, FontStyle.Bold);
private readonly Color BACK_COLOR = Color.FromArgb(30, 30, 30);
private readonly SolidBrush RING_ON = new SolidBrush(Color.FromArgb(10, 190, 10));
private readonly SolidBrush RING_OFF = new SolidBrush(Color.FromArgb(220, 10, 10));
private readonly SolidBrush RING_NO = new SolidBrush(Color.FromArgb(180, 180, 180));
private readonly SolidBrush TEXT_BRUSH = new SolidBrush(Color.FromArgb(240, 240, 240));
public InputDisplay(PictureBox pic)
{
_pic = pic;
pic.Resize += Pic_Resize;
pic.Paint += Pic_Paint;
}
public bool IsRun
{
set
{
_isrun = value;
_pic.Refresh();
}
get
{
return _isrun;
}
}
public void SetState(IOModule.Box_Sta[] sta)
{
int min = sta.Length < _state.Length ? sta.Length : _state.Length;
Array.Copy(sta, 0, _state, 0, min);
_pic.Refresh();
}
public void SetCount(int count)
{
_count = count;
_rect = new RectangleF[count];
_rectText = new RectangleF[count];
_text = new string[count];
_state = new IOModule.Box_Sta[count];
for (int i = 0; i < count; i++)
_text[i] = (i + 1).ToString();
CalcSize();
_pic.Refresh();
}
private void CalcSize()
{
int col = 8;
int row = Convert.ToInt32(Math.Ceiling((float)_count / col));
float w = (float)_pic.ClientSize.Width / (col + 1);
float h = (float)_pic.ClientSize.Height / (row + 1);
float x = 0, y = 0;
Graphics g = _pic.CreateGraphics();
_rect = new RectangleF[_count];
for (int i = 0; i < _count; i++)
{
if (i % col == 0)
{
x = w;
y += h;
}
else
{
x += w;
}
_rect[i] = new RectangleF(x - RADIUS, y - RADIUS, RADIUS + RADIUS, RADIUS + RADIUS);
SizeF sf = g.MeasureString(_text[i], TEXT_FONT);
_rectText[i] = new RectangleF(x - sf.Width / 2f, y - sf.Height / 2f + 1, sf.Width, sf.Height);
}
}
private void Pic_Resize(object sender, EventArgs e)
{
CalcSize();
_pic.Refresh();
}
private void Pic_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(BACK_COLOR);
for (int i = 0; i < _rect.Length; i++)
{
if (_isrun)
g.FillEllipse(_state[i] == IOModule.Box_Sta.On ? RING_ON : RING_OFF, _rect[i]);
else
g.FillEllipse(RING_NO, _rect[i]);
g.DrawString(_text[i], TEXT_FONT, TEXT_BRUSH, _rectText[i]);
}
bg.Render();
bg.Dispose();
}
}
public class OutputDisplay
{
private bool _isrun;
private int _count;
private PictureBox _pic;
private RectangleF[] _rect;
private RectangleF[] _rectText;
private IOModule.Box_Sta[] _state;
private string[] _text;
private int _over = -1;
private int _down = -1;
public event Common.DO_Event DO_Click;
private const int RADIUS = 20;
private readonly Font TEXT_FONT = new Font("Arial", 14f, FontStyle.Bold);
private readonly Color BACK_COLOR = Color.FromArgb(30, 30, 30);
private readonly SolidBrush RING_ON = new SolidBrush(Color.FromArgb(10, 190, 10));
private readonly SolidBrush RING_OFF = new SolidBrush(Color.FromArgb(220, 10, 10));
private readonly SolidBrush RING_NO = new SolidBrush(Color.FromArgb(180, 180, 180));
private readonly SolidBrush TEXT_BRUSH = new SolidBrush(Color.FromArgb(240, 240, 240));
public OutputDisplay(PictureBox pic)
{
_pic = pic;
pic.MouseMove += Pic_MouseMove;
pic.MouseDown += Pic_MouseDown;
pic.MouseUp += Pic_MouseUp;
pic.Resize += Pic_Resize;
pic.Paint += Pic_Paint;
}
public bool IsRun
{
set
{
_isrun = value;
_pic.Refresh();
}
get
{
return _isrun;
}
}
public void SetState(IOModule.Box_Sta[] sta)
{
int min = sta.Length < _state.Length ? sta.Length : _state.Length;
Array.Copy(sta, 0, _state, 0, min);
_pic.Refresh();
}
public void SetCount(int count)
{
_count = count;
_rect = new RectangleF[count];
_rectText = new RectangleF[count];
_text = new string[count];
_state = new IOModule.Box_Sta[count];
for (int i = 0; i < count; i++)
_text[i] = (i + 1).ToString();
CalcSize();
_pic.Refresh();
}
private void CalcSize()
{
int col = 8;
int row = Convert.ToInt32(Math.Ceiling((float)_count / col));
float w = (float)_pic.ClientSize.Width / (col + 1);
float h = (float)_pic.ClientSize.Height / (row + 1);
float x = 0, y = 0;
Graphics g = _pic.CreateGraphics();
_rect = new RectangleF[_count];
for (int i = 0; i < _count; i++)
{
if (i % col == 0)
{
x = w;
y += h;
}
else
{
x += w;
}
_rect[i] = new RectangleF(x - RADIUS, y - RADIUS, RADIUS + RADIUS, RADIUS + RADIUS);
SizeF sf = g.MeasureString(_text[i], TEXT_FONT);
_rectText[i] = new RectangleF(x - sf.Width / 2f, y - sf.Height / 2f + 1, sf.Width, sf.Height);
}
}
private void Pic_MouseMove(object sender, MouseEventArgs e)
{
int n = -1;
for (int i = 0; i < _rect.Length; i++)
{
if (_rect[i].Contains(e.Location))
{
n = i;
break;
}
}
if (n != _over)
{
_over = n;
_pic.Refresh();
}
}
private void Pic_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (_down > -1)
{
_down = -1;
_pic.Refresh();
}
}
}
private void Pic_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (_over > -1)
{
_down = _over;
_pic.Refresh();
if (IsRun) DO_Click?.Invoke(_down);
}
}
}
private void Pic_Resize(object sender, EventArgs e)
{
CalcSize();
_pic.Refresh();
}
private void Pic_Paint(object sender, PaintEventArgs e)
{
BufferedGraphicsContext current = BufferedGraphicsManager.Current;
BufferedGraphics bg = current.Allocate(e.Graphics, e.ClipRectangle);
Graphics g = bg.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.Clear(BACK_COLOR);
for (int i = 0; i < _rect.Length; i++)
{
if (_isrun)
{
g.FillEllipse(_state[i] == IOModule.Box_Sta.On ? RING_ON : RING_OFF, _rect[i]);
if (i == _down)
g.DrawRectangle(new Pen(Color.White, 2), _rect[i].X - 3, _rect[i].Y - 3, _rect[i].Width + 6, _rect[i].Height + 6);
else if (i == _over)
g.DrawRectangle(new Pen(Color.White, 1), _rect[i].X - 3, _rect[i].Y - 3, _rect[i].Width + 6, _rect[i].Height + 6);
}
else
{
g.FillEllipse(RING_NO, _rect[i]);
}
g.DrawString(_text[i], TEXT_FONT, TEXT_BRUSH, _rectText[i]);
}
bg.Render();
bg.Dispose();
}
}
}
using System;
namespace Asa
{
public class Common
{
public static IOModule.AIOBOX box;
public static string[] localIP;
public static int localIndex;
public static int inputCount;
public static int outputCount;
public static int inputSleep;
public static int outputSleep;
public static bool autoUpload;
public static bool autoRead;
public delegate void DO_Event(int index);
}
}
\ No newline at end of file
namespace AIOBOX_Debug
{
partial class FrmIO
{
/// <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.checkBox1 = new System.Windows.Forms.CheckBox();
this.label4 = new System.Windows.Forms.Label();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
this.BtnCancel = new System.Windows.Forms.Button();
this.BtnOK = new System.Windows.Forms.Button();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.checkBox2 = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.SuspendLayout();
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(209, 29);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(90, 16);
this.checkBox1.TabIndex = 28;
this.checkBox1.Text = "Auto Upload";
this.checkBox1.UseVisualStyleBackColor = true;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(125, 11);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(77, 12);
this.label4.TabIndex = 25;
this.label4.Text = "AutoRead(ms)";
//
// numericUpDown3
//
this.numericUpDown3.Location = new System.Drawing.Point(123, 26);
this.numericUpDown3.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.numericUpDown3.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown3.Name = "numericUpDown3";
this.numericUpDown3.Size = new System.Drawing.Size(80, 21);
this.numericUpDown3.TabIndex = 24;
this.numericUpDown3.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// numericUpDown4
//
this.numericUpDown4.Location = new System.Drawing.Point(123, 53);
this.numericUpDown4.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.numericUpDown4.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown4.Name = "numericUpDown4";
this.numericUpDown4.Size = new System.Drawing.Size(80, 21);
this.numericUpDown4.TabIndex = 23;
this.numericUpDown4.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(59, 11);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 12);
this.label3.TabIndex = 22;
this.label3.Text = "Count";
//
// BtnCancel
//
this.BtnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.BtnCancel.Location = new System.Drawing.Point(226, 121);
this.BtnCancel.Name = "BtnCancel";
this.BtnCancel.Size = new System.Drawing.Size(75, 23);
this.BtnCancel.TabIndex = 21;
this.BtnCancel.Text = "Cancel";
this.BtnCancel.UseVisualStyleBackColor = true;
this.BtnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// BtnOK
//
this.BtnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.BtnOK.Location = new System.Drawing.Point(145, 121);
this.BtnOK.Name = "BtnOK";
this.BtnOK.Size = new System.Drawing.Size(75, 23);
this.BtnOK.TabIndex = 20;
this.BtnOK.Text = "OK";
this.BtnOK.UseVisualStyleBackColor = true;
this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(57, 53);
this.numericUpDown2.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(60, 21);
this.numericUpDown2.TabIndex = 19;
this.numericUpDown2.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(57, 26);
this.numericUpDown1.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(60, 21);
this.numericUpDown1.TabIndex = 18;
this.numericUpDown1.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 17;
this.label2.Text = "Output";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 12);
this.label1.TabIndex = 16;
this.label1.Text = "Input";
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(209, 56);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(78, 16);
this.checkBox2.TabIndex = 29;
this.checkBox2.Text = "Auto Read";
this.checkBox2.UseVisualStyleBackColor = true;
//
// FrmIO
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(313, 156);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.label4);
this.Controls.Add(this.numericUpDown3);
this.Controls.Add(this.numericUpDown4);
this.Controls.Add(this.label3);
this.Controls.Add(this.BtnCancel);
this.Controls.Add(this.BtnOK);
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmIO";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FrmIO";
this.Load += new System.EventHandler(this.FrmIO_Load);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.NumericUpDown numericUpDown3;
private System.Windows.Forms.NumericUpDown numericUpDown4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button BtnCancel;
private System.Windows.Forms.Button BtnOK;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox checkBox2;
}
}
\ No newline at end of file
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 AIOBOX_Debug
{
public partial class FrmIO : Form
{
public FrmIO()
{
InitializeComponent();
}
private void FrmIO_Load(object sender, EventArgs e)
{
numericUpDown1.Value = Asa.Common.inputCount;
numericUpDown2.Value = Asa.Common.outputCount;
numericUpDown3.Value = Asa.Common.inputSleep;
numericUpDown4.Value = Asa.Common.outputSleep;
checkBox1.Checked = Asa.Common.autoUpload;
checkBox2.Checked = Asa.Common.autoRead;
}
private void BtnOK_Click(object sender, EventArgs e)
{
int n;
n = Convert.ToInt32(numericUpDown1.Value);
Asa.Common.box.SetInput(Asa.IOModule.Box_Type.DI, n);
Asa.Common.inputCount = n;
n = Convert.ToInt32(numericUpDown2.Value);
Asa.Common.box.SetOutput(Asa.IOModule.Box_Type.DO, n);
Asa.Common.outputCount = n;
n = Convert.ToInt32(numericUpDown3.Value);
Asa.Common.inputSleep = n;
if (checkBox1.Checked)
Asa.Common.box.AutoReadInput(true);
else
Asa.Common.box.AutoReadInput(true, n);
n = Convert.ToInt32(numericUpDown4.Value);
Asa.Common.box.AutoReadOutput(checkBox2.Checked, n);
Asa.Common.outputSleep = n;
Asa.Common.autoUpload = checkBox1.Checked;
Asa.Common.autoRead = checkBox2.Checked;
DialogResult = DialogResult.OK;
}
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}
<?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>
\ No newline at end of file
namespace AIOBOX_Debug
{
partial class FrmIP
{
/// <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.label3 = new System.Windows.Forms.Label();
this.BtnPing = new System.Windows.Forms.Button();
this.BtnCancel = new System.Windows.Forms.Button();
this.BtnOK = new System.Windows.Forms.Button();
this.BtnIP = new System.Windows.Forms.Button();
this.TxtIP = new System.Windows.Forms.TextBox();
this.CboIP = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label3
//
this.label3.Location = new System.Drawing.Point(69, 66);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(123, 58);
this.label3.TabIndex = 17;
this.label3.Text = "label3";
//
// BtnPing
//
this.BtnPing.Location = new System.Drawing.Point(198, 66);
this.BtnPing.Name = "BtnPing";
this.BtnPing.Size = new System.Drawing.Size(75, 23);
this.BtnPing.TabIndex = 16;
this.BtnPing.Text = "Ping";
this.BtnPing.UseVisualStyleBackColor = true;
this.BtnPing.Click += new System.EventHandler(this.BtnPing_Click);
//
// BtnCancel
//
this.BtnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.BtnCancel.Location = new System.Drawing.Point(200, 130);
this.BtnCancel.Name = "BtnCancel";
this.BtnCancel.Size = new System.Drawing.Size(75, 23);
this.BtnCancel.TabIndex = 15;
this.BtnCancel.Text = "Cancel";
this.BtnCancel.UseVisualStyleBackColor = true;
this.BtnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// BtnOK
//
this.BtnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.BtnOK.Location = new System.Drawing.Point(119, 130);
this.BtnOK.Name = "BtnOK";
this.BtnOK.Size = new System.Drawing.Size(75, 23);
this.BtnOK.TabIndex = 14;
this.BtnOK.Text = "OK";
this.BtnOK.UseVisualStyleBackColor = true;
this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// BtnIP
//
this.BtnIP.Location = new System.Drawing.Point(198, 37);
this.BtnIP.Name = "BtnIP";
this.BtnIP.Size = new System.Drawing.Size(75, 23);
this.BtnIP.TabIndex = 13;
this.BtnIP.Text = "Get IP";
this.BtnIP.UseVisualStyleBackColor = true;
this.BtnIP.Click += new System.EventHandler(this.BtnIP_Click);
//
// TxtIP
//
this.TxtIP.Location = new System.Drawing.Point(71, 38);
this.TxtIP.Name = "TxtIP";
this.TxtIP.Size = new System.Drawing.Size(121, 21);
this.TxtIP.TabIndex = 12;
//
// CboIP
//
this.CboIP.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboIP.FormattingEnabled = true;
this.CboIP.Location = new System.Drawing.Point(71, 12);
this.CboIP.Name = "CboIP";
this.CboIP.Size = new System.Drawing.Size(121, 20);
this.CboIP.TabIndex = 11;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(24, 41);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 10;
this.label2.Text = "I/O IP";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 9;
this.label1.Text = "Local IP";
//
// FrmIP
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(287, 165);
this.Controls.Add(this.label3);
this.Controls.Add(this.BtnPing);
this.Controls.Add(this.BtnCancel);
this.Controls.Add(this.BtnOK);
this.Controls.Add(this.BtnIP);
this.Controls.Add(this.TxtIP);
this.Controls.Add(this.CboIP);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmIP";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FrmIP";
this.Load += new System.EventHandler(this.FrmIP_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button BtnPing;
private System.Windows.Forms.Button BtnCancel;
private System.Windows.Forms.Button BtnOK;
private System.Windows.Forms.Button BtnIP;
private System.Windows.Forms.TextBox TxtIP;
private System.Windows.Forms.ComboBox CboIP;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
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 AIOBOX_Debug
{
public partial class FrmIP : Form
{
public FrmIP()
{
InitializeComponent();
}
private void FrmIP_Load(object sender, EventArgs e)
{
CboIP.Items.AddRange(Asa.Common.localIP);
CboIP.SelectedIndex = Asa.Common.localIndex;
TxtIP.Text = Asa.Common.box.IP;
label3.Text = "";
}
private void BtnIP_Click(object sender, EventArgs e)
{
bool rtn = Asa.Common.box.AutoIP(CboIP.Text);
if (rtn)
{
TxtIP.Text = Asa.Common.box.IP;
label3.ForeColor = Color.Lime;
label3.Text = "OK";
}
else
{
label3.ForeColor = Color.Red;
label3.Text = Asa.Common.box.ErrInfo;
}
}
private void BtnOK_Click(object sender, EventArgs e)
{
Asa.Common.localIndex = CboIP.SelectedIndex;
Asa.Common.box.IP = TxtIP.Text;
DialogResult = DialogResult.OK;
}
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void BtnPing_Click(object sender, EventArgs e)
{
bool rtn = Asa.Common.box.CheckIP(TxtIP.Text);
if (rtn)
{
label3.ForeColor = Color.Lime;
label3.Text = "OK";
}
else
{
label3.ForeColor = Color.Red;
label3.Text = Asa.Common.box.ErrInfo;
}
}
}
}
<?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>
\ No newline at end of file
namespace AIOBOX_Debug
{
partial class FrmMain
{
/// <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.pictureBox1 = new System.Windows.Forms.PictureBox();
this.BtnIP = new System.Windows.Forms.Button();
this.BtnIO = new System.Windows.Forms.Button();
this.BtnCon = new System.Windows.Forms.Button();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.ChkLog = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Location = new System.Drawing.Point(12, 41);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(507, 166);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// BtnIP
//
this.BtnIP.Location = new System.Drawing.Point(12, 12);
this.BtnIP.Name = "BtnIP";
this.BtnIP.Size = new System.Drawing.Size(75, 23);
this.BtnIP.TabIndex = 1;
this.BtnIP.Text = "IP Set";
this.BtnIP.UseVisualStyleBackColor = true;
this.BtnIP.Click += new System.EventHandler(this.BtnIP_Click);
//
// BtnIO
//
this.BtnIO.Location = new System.Drawing.Point(93, 12);
this.BtnIO.Name = "BtnIO";
this.BtnIO.Size = new System.Drawing.Size(75, 23);
this.BtnIO.TabIndex = 2;
this.BtnIO.Text = "IO Set";
this.BtnIO.UseVisualStyleBackColor = true;
this.BtnIO.Click += new System.EventHandler(this.BtnIO_Click);
//
// BtnCon
//
this.BtnCon.Location = new System.Drawing.Point(174, 12);
this.BtnCon.Name = "BtnCon";
this.BtnCon.Size = new System.Drawing.Size(75, 23);
this.BtnCon.TabIndex = 3;
this.BtnCon.Text = "Connect";
this.BtnCon.UseVisualStyleBackColor = true;
this.BtnCon.Click += new System.EventHandler(this.BtnCon_Click);
//
// pictureBox2
//
this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox2.Location = new System.Drawing.Point(12, 213);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(507, 166);
this.pictureBox2.TabIndex = 4;
this.pictureBox2.TabStop = false;
//
// ChkLog
//
this.ChkLog.AutoSize = true;
this.ChkLog.Location = new System.Drawing.Point(255, 16);
this.ChkLog.Name = "ChkLog";
this.ChkLog.Size = new System.Drawing.Size(84, 16);
this.ChkLog.TabIndex = 5;
this.ChkLog.Text = "Log output";
this.ChkLog.UseVisualStyleBackColor = true;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(531, 393);
this.Controls.Add(this.ChkLog);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.BtnCon);
this.Controls.Add(this.BtnIO);
this.Controls.Add(this.BtnIP);
this.Controls.Add(this.pictureBox1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "IO Module Test";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
this.Load += new System.EventHandler(this.FrmMain_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button BtnIP;
private System.Windows.Forms.Button BtnIO;
private System.Windows.Forms.Button BtnCon;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.CheckBox ChkLog;
}
}
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;
using Asa;
namespace AIOBOX_Debug
{
public partial class FrmMain : Form
{
private InputDisplay input;
private OutputDisplay output;
public FrmMain()
{
InitializeComponent();
}
private void FrmMain_Load(object sender, EventArgs e)
{
input = new InputDisplay(pictureBox1);
input.SetCount(16);
output = new OutputDisplay(pictureBox2);
output.SetCount(16);
output.DO_Click += Output_DO_Click;
Common.box = new Asa.IOModule.AIOBOX();
Common.box.DI_Changed_Event += DI_Changed;
Common.box.DO_Changed_Event += DO_Changed;
Common.localIP = Common.box.GetLocalIP();
Common.localIndex = 0;
Common.inputCount = 16;
Common.outputCount = 16;
Common.inputSleep = 100;
Common.outputSleep = 100;
Common.autoUpload = false;
Common.autoRead = false;
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
Common.box.Close();
}
private void DI_Changed(Asa.IOModule.AIOBOX box, Asa.IOModule.Box_Sta[] sta)
{
this.Invoke(new Action(() => { input.SetState(sta); }));
}
private void DO_Changed(Asa.IOModule.AIOBOX box, Asa.IOModule.Box_Sta[] sta)
{
this.Invoke(new Action(() => { output.SetState(sta); }));
}
private void Output_DO_Click(int index)
{
Asa.IOModule.Box_Sta sta = Common.box.ReadDO(index);
sta = Common.box.ReverseStatus(sta);
Common.box.WriteDO(index, sta);
}
private void BtnIP_Click(object sender, EventArgs e)
{
using (FrmIP frm = new FrmIP { Text = BtnIP.Text })
{
frm.ShowDialog();
}
}
private void BtnIO_Click(object sender, EventArgs e)
{
using (FrmIO frm = new FrmIO { Text = BtnIO.Text })
{
if (frm.ShowDialog() == DialogResult.OK)
{
input.SetCount(Common.inputCount);
output.SetCount(Common.outputCount);
}
}
}
private void BtnCon_Click(object sender, EventArgs e)
{
if (Common.box.IsConn)
{
Common.box.Close();
BtnCon.Text = "Connect";
input.IsRun = false;
output.IsRun = false;
}
else
{
if (ChkLog.Checked)
Common.box.LogPath(Application.StartupPath + "\\", Asa.IOModule.LogType.All);
else
Common.box.LogPath(null, Asa.IOModule.LogType.All);
Common.box.Connect();
if (Common.box.IsConn)
{
BtnCon.Text = "Disconnect";
input.IsRun = true;
output.IsRun = true;
}
else
{
MessageBox.Show(Common.box.ErrInfo);
}
}
}
}
}
<?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>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AIOBOX_Debug
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AIOBOX_Debug")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AIOBOX_Debug")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("20c68949-5711-4149-b9c0-26b8edc2b5d3")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AIOBOX_Debug.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AIOBOX_Debug.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AIOBOX_Debug.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0"?>
<doc>
<assembly>
<name>Asa.IOModule.AIOBOX</name>
</assembly>
<members>
<member name="T:Asa.IOModule.AIOBOX">
<summary>
AIOBOX操作类
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.SEND_SLEEP">
<summary>
每条命令发送的间隔
不能小于15,会出现IO接收不到的情况
小于30时,会出现接收数据连包的情况
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.PORT">
<summary>
ModBus端口
</summary>
</member>
<member name="T:Asa.IOModule.AIOBOX.DIO_Changed">
<summary>
自动读取DI委托
</summary>
<param name="box">AIOBOX</param>
<param name="sta">所有DI状态</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.DI_Changed_Event">
<summary>
自动读取DI事件触发
</summary>
</member>
<member name="E:Asa.IOModule.AIOBOX.DO_Changed_Event">
<summary>
自动读取DO事件触发
</summary>
</member>
<member name="T:Asa.IOModule.AIOBOX.AIO_Changed">
<summary>
自动读取AI委托
</summary>
<param name="box">AIOBOX</param>
<param name="val">所有AI的值</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.AI_Changed_Event">
<summary>
自动读取AI事件触发
</summary>
</member>
<member name="E:Asa.IOModule.AIOBOX.AO_Changed_Event">
<summary>
自动读取AO事件触发
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.#ctor">
<summary>
AIOBOX
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.IP">
<summary>
IP地址
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.IsConn">
<summary>
是否连接
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.ErrInfo">
<summary>
错误信息
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.LogPath(System.String,Asa.IOModule.LogType)">
<summary>
日志路径,连接前设置路径会自动保存日志
</summary>
<param name="path">文件夹路径</param>
<param name="type">输出类型</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetInput(Asa.IOModule.Box_Type,System.Int32)">
<summary>
设置输入端
</summary>
<param name="type">类型</param>
<param name="count">数量</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetOutput(Asa.IOModule.Box_Type,System.Int32)">
<summary>
设置输出端
</summary>
<param name="type">类型</param>
<param name="count">数量</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoIP(System.String)">
<summary>
自动获取IP地址,未连接前使用,必须在同一网段
</summary>
<param name="localIP">本地IP地址</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.CheckIP(System.String)">
<summary>
检查IP地址
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Connect">
<summary>
连接
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Close">
<summary>
关闭连接
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput(System.Boolean,System.Int32)">
<summary>
自动读取输入端并触发事件(主动上传数据 = 禁止)
</summary>
<param name="read">是否自动读取</param>
<param name="sleep">间隔,必须大于等于15ms</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput(System.Boolean)">
<summary>
自动读取输入端并触发事件(主动上传数据 = 使能)
</summary>
<param name="read">是否自动读取</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadOutput(System.Boolean,System.Int32)">
<summary>
自动读取输出端,触发事件
</summary>
<param name="read">是否自动读取</param>
<param name="sleep">间隔,必须大于等于15ms</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReverseStatus(Asa.IOModule.Box_Sta)">
<summary>
相反状态(ON/OFF)
</summary>
<param name="sta"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReverseStatus(Asa.IOModule.Box_Sta@)">
<summary>
相反状态(ON/OFF)
</summary>
<param name="sta"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Int32)">
<summary>
读取单个DI输入状态(ON/OFF)
</summary>
<param name="add">输入地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Int32,System.Int32)">
<summary>
读取多个DI输入状态(ON/OFF)
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Int32)">
<summary>
读取单个AI模拟量的值
</summary>
<param name="add">模拟量地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Int32,System.Int32)">
<summary>
读取多个AI模拟量的值
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Int32)">
<summary>
读取单个DO输出状态(ON/OFF)
</summary>
<param name="add">输出地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Int32,System.Int32)">
<summary>
读取多个DO输出状态(ON/OFF)
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAO(System.Int32)">
<summary>
读取单个AO模拟量的值
</summary>
<param name="add">输出地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAO(System.Int32,System.Int32)">
<summary>
读取多个AO模拟量的值
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.WriteDO(System.Int32,Asa.IOModule.Box_Sta)">
<summary>
写入单个DO输出状态(ON/OFF)
</summary>
<param name="add">输出地址,从0开始</param>
<param name="sta"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.GetLocalIP">
<summary>
获取本地IPv4地址
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Send">
<summary>
发送命令
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Receive">
<summary>
接收命令
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadSingle(System.Byte[])">
<summary>
读取写入单个DO,功能码5
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Byte[])">
<summary>
读取所有DO状态,功能码1
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Byte[])">
<summary>
读取所有DI状态,功能码2
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Byte[])">
<summary>
读取所有AI的值,功能码4
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.Command">
<summary>
命令,前7个字节
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.TriggerDIO">
<summary>
触发DIO改变事件
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput">
<summary>
自动读取输入端线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadOutput">
<summary>
自动读取输出端线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Listen">
<summary>
监听结果线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.TestMethod">
<summary>
测试方法锁
</summary>
</member>
<member name="T:Asa.IOModule.Box_Type">
<summary>
IO模块类型
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.DI">
<summary>
数字信号输入
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.DO">
<summary>
数字信号输出
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.AI">
<summary>
模拟量输入
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.AO">
<summary>
模拟量输出
</summary>
</member>
<member name="T:Asa.IOModule.Box_Sta">
<summary>
IO模块寄存器状态
</summary>
</member>
<member name="F:Asa.IOModule.Box_Sta.Off">
<summary>
断开,关闭,低电平
</summary>
</member>
<member name="F:Asa.IOModule.Box_Sta.On">
<summary>
闭合,打开,高电平
</summary>
</member>
<member name="T:Asa.IOModule.LogType">
<summary>
日志类型
</summary>
</member>
<member name="F:Asa.IOModule.LogType.OnlyError">
<summary>
仅错误信息
</summary>
</member>
<member name="F:Asa.IOModule.LogType.All">
<summary>
所有
</summary>
</member>
<member name="T:Asa.IOModule.LogFile">
<summary>
日志操作类
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.#ctor(System.String,System.String)">
<summary>
日志
</summary>
<param name="path">文件夹路径</param>
<param name="ip"></param>
</member>
<member name="M:Asa.IOModule.LogFile.Close">
<summary>
关闭文件
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.OutError(System.String)">
<summary>
输出错误
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutInfo(System.String)">
<summary>
输出信息
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String,System.Byte[])">
<summary>
输出数据
</summary>
<param name="tr"></param>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String)">
<summary>
输出数据
</summary>
<param name="s"></param>
</member>
</members>
</doc>
C:\MY\DLL Coding\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.exe.config
C:\MY\DLL Coding\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.exe
C:\MY\DLL Coding\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.pdb
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csprojAssemblyReference.cache
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmMain.resources
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.Properties.Resources.resources
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.GenerateResource.cache
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.exe
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.pdb
C:\MY\DLL Coding\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\MY\DLL Coding\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\MY\DLL Coding\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.CopyComplete
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmIO.resources
C:\MY\DLL Coding\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmIP.resources
C:\SMD\DLL\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.exe.config
C:\SMD\DLL\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.exe
C:\SMD\DLL\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.pdb
C:\SMD\DLL\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\SMD\DLL\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\SMD\DLL\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csprojAssemblyReference.cache
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmIO.resources
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmIP.resources
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmMain.resources
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.Properties.Resources.resources
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.GenerateResource.cache
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.CopyComplete
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.exe
C:\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.exe.config
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\bin\Debug\AIOBOX_Debug.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\bin\Debug\Asa.IOModule.AIOBOX.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmIO.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmIP.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.FrmMain.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.Properties.Resources.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.GenerateResource.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX_Debug\obj\Debug\AIOBOX_Debug.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug_old.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug.FrmIO.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug.FrmIP.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug.FrmMain.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug.Properties.Resources.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug_old.csproj.GenerateResource.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug_old.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\bin\Debug\AIOBOX_Debug.exe.config
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\bin\Debug\AIOBOX_Debug.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\bin\Debug\AIOBOX_Debug.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\bin\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\bin\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\bin\Debug\Asa.IOModule.AIOBOX.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_Debug_old\obj\Debug\AIOBOX_Debug_old.csproj.CopyComplete
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Generic;
namespace Asa.IOModule
{
/// <summary>
/// AIOBOX操作类
/// </summary>
public class AIOBOX
{
private Socket _client; //客户端
private bool _loop;
private string _logPath; //日志的文件夹路径
private LogFile _log; //日志的类
private LogType _logType; //日志输出类型
private bool _frontInputOutput; //True:Input False:Output
private int countInput; //输入总数
private int countOutput; //输出总数
private int sleepInput; //自动读取DI间隔
private int sleepOutput; //自动读取DO间隔
private Box_Type _typeInput; //输入类型
private Box_Type _typeOutput; //输出类型
private byte[] _addressInput; //输入地址
private byte[] _addressOutput; //输出地址
private bool _autoReadInput; //自动读取DI
private bool _autoReadOutput; //自动读取DO
private bool _manualReadOutput; //手动读取DO
private bool _changeDI; //DI收到数据触发事件
private bool _changeDO; //DO收到数据触发事件
private bool _changeAI; //AI收到数据触发事件
private bool _changeAO; //AO收到数据触发事件
private Box_Sta[] _stateDI; //状态
private Box_Sta[] _stateDO; //状态
private int[] _valueAI; //模拟量
private int[] _valueAO; //模拟量
private System.Collections.Concurrent.ConcurrentQueue<ushort> _flag;
private System.Collections.Concurrent.ConcurrentQueue<byte[]> _send;
private System.Collections.Concurrent.ConcurrentQueue<byte[]> _receive;
private Thread tSend; //发送命令处理
private Thread tReceive; //接收信息处理
private Thread tListen; //监听网络
private Thread tTrigger; //触发DI、DO改变事件
private Thread tReadInput; //自动读取DI线程
private Thread tReadOutput; //自动读取DO线程
private Thread tFlag; //ModBusTCP标识
private UdpClient broadcastClient; //广播客户端
private IPEndPoint broadcastEndPoint; //广播远程节点
private byte[] broadcastBuffer; //远程返回数据
/// <summary>
/// 每条命令发送的间隔
/// 不能小于15,会出现IO接收不到的情况
/// 小于30时,会出现接收数据连包的情况
/// </summary>
private const int SEND_SLEEP = 30;
/// <summary>
/// ModBus端口
/// </summary>
public const int PORT = 502;
/// <summary>
/// 自动读取DI委托
/// </summary>
/// <param name="box">AIOBOX</param>
/// <param name="sta">所有DI状态</param>
public delegate void DIO_Changed(AIOBOX box, Box_Sta[] sta);
/// <summary>
/// 自动读取DI事件触发
/// </summary>
public event DIO_Changed DI_Changed_Event;
/// <summary>
/// 自动读取DO事件触发
/// </summary>
public event DIO_Changed DO_Changed_Event;
/// <summary>
/// 自动读取AI委托
/// </summary>
/// <param name="box">AIOBOX</param>
/// <param name="val">所有AI的值</param>
public delegate void AIO_Changed(AIOBOX box, int[] val);
/// <summary>
/// 自动读取AI事件触发
/// </summary>
public event AIO_Changed AI_Changed_Event;
/// <summary>
/// 自动读取AO事件触发
/// </summary>
public event AIO_Changed AO_Changed_Event;
/// <summary>
/// AIOBOX
/// </summary>
public AIOBOX()
{
_log = null;
_logPath = null;
_autoReadInput = false;
_autoReadOutput = false;
_manualReadOutput = false;
sleepInput = 100;
sleepOutput = 100;
}
/// <summary>
/// IP地址
/// </summary>
public string IP { set; get; } = "192.168.1.100";
/// <summary>
/// 是否连接
/// </summary>
public bool IsConn { get; private set; } = false;
/// <summary>
/// 错误信息
/// </summary>
public string ErrInfo { get; private set; } = "";
/// <summary>
/// 日志路径,连接前设置路径会自动保存日志
/// </summary>
/// <param name="path">文件夹路径</param>
/// <param name="type">输出类型</param>
public void LogPath(string path, LogType type)
{
_logPath = path;
_logType = type;
}
/// <summary>
/// 设置输入端
/// </summary>
/// <param name="type">类型</param>
/// <param name="count">数量</param>
public void SetInput(Box_Type type, int count)
{
_typeInput = type;
countInput = count;
_frontInputOutput = false;
}
/// <summary>
/// 设置输出端
/// </summary>
/// <param name="type">类型</param>
/// <param name="count">数量</param>
public void SetOutput(Box_Type type, int count)
{
_typeOutput = type;
countOutput = count;
_frontInputOutput = true;
}
/// <summary>
/// 自动获取IP地址,未连接前使用,必须在同一网段
/// </summary>
/// <param name="localIP">本地IP地址</param>
/// <returns></returns>
public bool AutoIP(string localIP)
{
try
{
IPEndPoint local = new IPEndPoint(IPAddress.Parse(localIP), 55654);
broadcastClient = new UdpClient(local);
broadcastBuffer = null;
Thread tTemp = new Thread(new ThreadStart(GetIP));
tTemp.Start();
broadcastEndPoint = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 1024);
byte[] dgram = new byte[] { 0x05, 0x00, 0x07, 0x00, 0x00, 0xC1, 0x59 };
broadcastClient.Send(dgram, dgram.Length, broadcastEndPoint);
Thread.Sleep(1000);
tTemp.Abort();
broadcastClient.Close();
ErrInfo = "无法访问";
if (broadcastBuffer == null) return false;
if (broadcastBuffer[0] != 0x3B) return false;
byte[] buff = new byte[broadcastBuffer[7]];
Array.Copy(broadcastBuffer, 9, buff, 0, buff.Length);
IP = buff[buff.Length - 12] + "." + buff[buff.Length - 11] + "." + buff[buff.Length - 10] + "." + buff[buff.Length - 9];
ErrInfo = "OK";
return true;
}
catch (Exception ex)
{
ErrInfo = ex.Message;
return false;
}
}
/// <summary>
/// 检查IP地址
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public bool CheckIP(string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
ErrInfo = "非法的IP地址";
return false;
}
//Ping服务端
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 1000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
ErrInfo = "Ping " + ip + " 请求没有响应";
return false;
}
return true;
}
/// <summary>
/// 连接
/// </summary>
/// <returns></returns>
public bool Connect()
{
try
{
//初始化地址
InitAddr();
//检查IP地址
bool rtn = CheckIP(IP);
if (!rtn) return false;
_send = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
_receive = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
_flag = new System.Collections.Concurrent.ConcurrentQueue<ushort>();
//建立连接
_client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
_client.Connect(IPAddress.Parse(IP), PORT);
Thread.Sleep(100); //需要等待一会才能获取连接状态
tFlag = new Thread(new ThreadStart(Flag));
tFlag.Start();
Thread.Sleep(10);
if (_logPath == null)
_log = null;
else
_log = new LogFile(_logPath, IP);
tSend = new Thread(new ThreadStart(Send));
tReceive = new Thread(new ThreadStart(Receive));
tListen = new Thread(new ThreadStart(Listen));
tTrigger = new Thread(new ThreadStart(TriggerDIO));
tReadInput = new Thread(new ThreadStart(AutoReadInput));
tReadOutput = new Thread(new ThreadStart(AutoReadOutput));
tListen.Start();
tTrigger.Start();
tSend.Start();
tReceive.Start();
tReadInput.Start();
tReadOutput.Start();
IsConn = true;
ErrInfo = "";
if (_log != null) _log.OutData("Connect OK");
return true;
}
catch (Exception ex)
{
IsConn = false;
ErrInfo = ex.Message;
if (_log != null) _log.OutError(ex.Message);
return false;
}
}
/// <summary>
/// 关闭连接
/// </summary>
public void Close()
{
IsConn = false;
if (tListen != null) tListen.Abort();
tListen = null;
if (tReadInput != null) tReadInput.Abort();
tReadInput = null;
if (tReadOutput != null) tReadOutput.Abort();
tReadOutput = null;
if (tTrigger != null) tTrigger.Abort();
tTrigger = null;
if (tSend != null) tSend.Abort();
tSend = null;
if (tReceive != null) tReceive.Abort();
tReceive = null;
if (tFlag != null) tFlag.Abort();
tFlag = null;
if (_client != null)
{
_client.Shutdown(SocketShutdown.Both);
_client.Close();
}
_client = null;
if (_log != null)
{
_log.OutData("Close OK");
_log.Close();
_log = null;
}
}
/// <summary>
/// 自动读取输入端并触发事件(主动上传数据 = 禁止)
/// </summary>
/// <param name="read">是否自动读取</param>
/// <param name="sleep">间隔,必须大于等于15ms</param>
public void AutoReadInput(bool read, int sleep)
{
if (countInput < 1)
_autoReadInput = false;
else if (sleep < 15)
_autoReadInput = false;
else if (read)
{
_autoReadInput = true;
sleepInput = sleep;
}
else
_autoReadInput = false;
}
/// <summary>
/// 自动读取输入端并触发事件(主动上传数据 = 使能)
/// </summary>
/// <param name="read">是否自动读取</param>
public void AutoReadInput(bool read)
{
if (countInput < 1)
_autoReadInput = false;
else if (read)
{
_autoReadInput = true;
sleepInput = 8000; //IO模块最大10s,避免超过时间,每8秒发送一次心跳包
}
else
_autoReadInput = false;
}
/// <summary>
/// 自动读取输出端,触发事件
/// </summary>
/// <param name="read">是否自动读取</param>
/// <param name="sleep">间隔,必须大于等于15ms</param>
public void AutoReadOutput(bool read, int sleep)
{
if (countOutput < 1)
{
_autoReadOutput = false;
sleepOutput = 100;
}
else if (sleep < 15)
{
_autoReadOutput = false;
sleepOutput = 100;
}
else if (read)
{
_autoReadOutput = true;
sleepOutput = sleep;
}
else
{
_autoReadOutput = false;
_manualReadOutput = true; //用于第一次连接的时候读取一次状态
sleepOutput = sleep;
}
}
/// <summary>
/// 相反状态(ON/OFF)
/// </summary>
/// <param name="sta"></param>
/// <returns></returns>
public Box_Sta ReverseStatus(Box_Sta sta)
{
return sta == Box_Sta.On ? Box_Sta.Off : Box_Sta.On;
}
/// <summary>
/// 相反状态(ON/OFF)
/// </summary>
/// <param name="sta"></param>
public void ReverseStatus(ref Box_Sta sta)
{
if (sta == Box_Sta.On)
sta = Box_Sta.Off;
else
sta = Box_Sta.On;
}
/// <summary>
/// 读取单个DI输入状态(ON/OFF)
/// </summary>
/// <param name="add">输入地址,从0开始</param>
/// <returns></returns>
public Box_Sta ReadDI(int add)
{
return _stateDI[add];
}
/// <summary>
/// 读取多个DI输入状态(ON/OFF)
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public Box_Sta[] ReadDI(int add, int count)
{
Box_Sta[] sta = new Box_Sta[count];
Array.Copy(_stateDI, add, sta, 0, count);
return sta;
}
/// <summary>
/// 读取单个AI模拟量的值
/// </summary>
/// <param name="add">模拟量地址,从0开始</param>
/// <returns></returns>
public int ReadAI(int add)
{
return _valueAI[add];
}
/// <summary>
/// 读取多个AI模拟量的值
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public int[] ReadAI(int add, int count)
{
int[] sta = new int[count];
Array.Copy(_valueAI, add, sta, 0, count);
return sta;
}
/// <summary>
/// 读取单个DO输出状态(ON/OFF)
/// </summary>
/// <param name="add">输出地址,从0开始</param>
/// <returns></returns>
public Box_Sta ReadDO(int add)
{
return _stateDO[add];
}
/// <summary>
/// 读取多个DO输出状态(ON/OFF)
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public Box_Sta[] ReadDO(int add, int count)
{
Box_Sta[] sta = new Box_Sta[count];
Array.Copy(_stateDO, add, sta, 0, count);
return sta;
}
/// <summary>
/// 读取单个AO模拟量的值
/// </summary>
/// <param name="add">输出地址,从0开始</param>
/// <returns></returns>
public int ReadAO(int add)
{
return _valueAO[add];
}
/// <summary>
/// 读取多个AO模拟量的值
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public int[] ReadAO(int add, int count)
{
int[] sta = new int[count];
Array.Copy(_valueAO, add, sta, 0, count);
return sta;
}
/// <summary>
/// 写入单个DO输出状态(ON/OFF)
/// </summary>
/// <param name="add">输出地址,从0开始</param>
/// <param name="sta"></param>
/// <returns></returns>
public bool WriteDO(int add, Box_Sta sta)
{
try
{
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[7] = 5; //功能码
buff[9] = _addressOutput[add]; //地址
buff[10] = (byte)sta; //写入值
_send.Enqueue(buff);
if (!_autoReadOutput)
_manualReadOutput = true;
return true;
}
catch (Exception ex)
{
ErrInfo = ex.Message;
return false;
}
}
/// <summary>
/// 获取本地IPv4地址
/// </summary>
/// <returns></returns>
public string[] GetLocalIP()
{
List<string> str = new List<string>();
IPAddress[] add = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
foreach (IPAddress ip in add)
{
if (ip.AddressFamily.ToString() == "InterNetwork")
str.Add(ip.ToString());
}
return str.ToArray();
}
/// <summary>
/// 发送命令
/// </summary>
private void Send()
{
while (_loop)
{
bool rtn = _send.TryDequeue(out byte[] result);
if (rtn)
{
try
{
_client.Send(result);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Send ", result);
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
Thread.Sleep(SEND_SLEEP);
}
}
/// <summary>
/// 接收命令
/// </summary>
private void Receive()
{
while (_loop)
{
if (_receive.TryDequeue(out byte[] buff))
{
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Receive ", buff);
}
if (buff.Length < 7)
continue;
if (buff[7] == 1)
{
ReadDO(buff);
_changeDO = true;
}
else if (buff[7] == 2)
{
ReadDI(buff);
_changeDI = true;
}
else if (buff[7] == 4)
{
ReadAI(buff);
_changeAI = true;
}
else if (buff[7] == 5)
{
//ReadSingle(buff);
}
}
Thread.Sleep(10);
}
}
/// <summary>
/// 读取写入单个DO,功能码5
/// </summary>
/// <param name="buff"></param>
private void ReadSingle(byte[] buff)
{
string s;
//if (LogOut)
//{
// byte[] bb = new byte[2];
// bb[0] = buff[1];
// bb[1] = buff[0];
// ushort flag = BitConverter.ToUInt16(bb, 0);
// s = string.Format("{0:HH:mm:ss:fff} WriteDO {1} fun={2} len={3}", DateTime.Now, flag, buff[7], buff.Length);
// _log.Add(s);
//}
// int n = 0;
// int move = 0;
// byte val = _receive[0][9];
// for (int i = 0; i < 8; i++)
// {
// n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
// _sta[i + 16] = n == 1 ? Box_Sta.On : Box_Sta.Off;
// move++;
// }
// if (_receive[0][8] == 2)
// {
// move = 0;
// val = _receive[0][10];
// for (int i = 8; i < 16; i++)
// {
// n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
// _sta[i + 16] = n == 1 ? Box_Sta.On : Box_Sta.Off;
// move++;
// }
// }
// ErrInfo = "OK";
//}
//catch (Exception ex)
//{
// ErrInfo = ex.Message;
//}
}
/// <summary>
/// 读取所有DO状态,功能码1
/// </summary>
/// <param name="buff"></param>
private void ReadDO(byte[] buff)
{
try
{
int idx = 0;
int count = buff[8];
for (int i = 1; i <= count; i++)
{
int n = 0;
int move = 0;
byte val = buff[8 + i];
for (int j = 0; j < 8; j++)
{
n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
_stateDO[idx++] = n == 1 ? Box_Sta.On : Box_Sta.Off;
move++;
}
}
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Read All DO");
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
/// <summary>
/// 读取所有DI状态,功能码2
/// </summary>
private void ReadDI(byte[] buff)
{
try
{
int idx = 0;
int count = buff[8];
for (int i = 1; i <= count; i++)
{
int n = 0;
int move = 0;
byte val = buff[8 + i];
for (int j = 0; j < 8; j++)
{
n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
_stateDI[idx++] = n == 1 ? Box_Sta.On : Box_Sta.Off;
move++;
}
}
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Read All DI");
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
/// <summary>
/// 读取所有AI的值,功能码4
/// </summary>
/// <param name="buff"></param>
private void ReadAI(byte[] buff)
{
try
{
if (countInput * 2 == buff[8])
{
_valueAI[0] = buff[9] * 256 + buff[10];
_valueAI[1] = buff[11] * 256 + buff[12];
_valueAI[2] = buff[13] * 256 + buff[14];
_valueAI[3] = buff[15] * 256 + buff[16];
}
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Read All AI");
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
/// <summary>
/// 命令,前7个字节
/// </summary>
/// <returns></returns>
private byte[] Command()
{
_flag.TryDequeue(out ushort result);
byte[] flag = BitConverter.GetBytes(result);
byte[] data = new byte[7];
data[0] = flag[1];
data[1] = flag[0];
data[2] = 0;
data[3] = 0;
data[4] = 0;
data[5] = 0;
data[6] = 255;
return data;
}
/// <summary>
/// 触发DIO改变事件
/// </summary>
private void TriggerDIO()
{
Box_Sta[] sta = null;
int[] val = null;
while (_loop)
{
//if (_autoReadInput)
//{
if (_typeInput == Box_Type.DI && DI_Changed_Event != null)
{
if (_changeDI)
{
sta = new Box_Sta[countInput];
Array.Copy(_stateDI, 0, sta, 0, sta.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger DI Event");
}
DI_Changed_Event.Invoke(this, sta);
_changeDI = false;
}
}
else if (_typeInput == Box_Type.AI && AI_Changed_Event != null)
{
if (_changeAI)
{
val = new int[countInput];
Array.Copy(_valueAI, 0, val, 0, val.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger AI Event");
}
AI_Changed_Event.Invoke(this, val);
_changeAI = false;
}
}
//}
//if (_autoReadOutput)
//{
if (_typeOutput == Box_Type.DO && DO_Changed_Event != null)
{
if (_changeDO)
{
sta = new Box_Sta[countOutput];
Array.Copy(_stateDO, 0, sta, 0, sta.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger DO Event");
}
DO_Changed_Event.Invoke(this, sta);
_changeDO = false;
}
}
else if (_typeOutput == Box_Type.AO && AO_Changed_Event != null)
{
if (_changeAO)
{
val = new int[countOutput];
Array.Copy(_valueAO, 0, val, 0, val.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger AO Event");
}
AO_Changed_Event.Invoke(this, val);
_changeAO = false;
}
}
//}
Thread.Sleep(10);
}
}
/// <summary>
/// 自动读取输入端线程
/// </summary>
private void AutoReadInput()
{
while (_loop)
{
if (IsConn && _autoReadInput)
{
//if (suspendDI && suspend > 0)
//{
// suspendDI = false;
// suspend--;
//}
//else
//{
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
//功能码
if (_typeInput == Box_Type.DI)
buff[7] = 2;
else if (_typeInput == Box_Type.AI)
buff[7] = 4;
buff[9] = _addressInput[0]; //地址
buff[11] = (byte)countInput; //个数
_send.Enqueue(buff);
//suspendDI = true;
//}
}
Thread.Sleep(sleepInput);
}
}
/// <summary>
/// 自动读取输出端线程
/// </summary>
private void AutoReadOutput()
{
while (_loop)
{
Thread.Sleep(sleepOutput);
if (!IsConn) continue;
if (!_autoReadOutput)
{
if (_manualReadOutput)
_manualReadOutput = false;
else
continue;
}
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
buff[7] = 1; //功能码
buff[9] = _addressOutput[0]; //地址
buff[11] = (byte)countOutput; //个数
_send.Enqueue(buff);
}
}
/// <summary>
/// 监听结果线程
/// </summary>
private void Listen()
{
byte[] temp = new byte[200];
int start, len;
while (_loop)
{
try
{
if (_client.Available > 0)
{
start = 0;
int count = _client.Receive(temp);
while (count - start > 6)
{
len = temp[start + 5];
len += 6;
if (start + len > count) break;
byte[] aa = new byte[len];
Array.Copy(temp, start, aa, 0, len);
_receive.Enqueue(aa);
start += len;
}
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
Thread.Sleep(10);
}
}
private void InitAddr()
{
byte n = 0;
if (_frontInputOutput)
{
_addressInput = new byte[countInput];
for (int i = 0; i < countInput; i++)
_addressInput[i] = n++;
_addressOutput = new byte[countOutput];
for (int i = 0; i < countOutput; i++)
_addressOutput[i] = n++;
}
else
{
_addressOutput = new byte[countOutput];
for (int i = 0; i < countOutput; i++)
_addressOutput[i] = n++;
_addressInput = new byte[countInput];
for (int i = 0; i < countInput; i++)
_addressInput[i] = n++;
}
_stateDI = new Box_Sta[countInput];
_stateDO = new Box_Sta[countOutput];
_valueAI = new int[countInput];
_valueAO = new int[countOutput];
}
private void GetIP()
{
broadcastBuffer = broadcastClient.Receive(ref broadcastEndPoint);
}
private void Flag()
{
ushort n = 0;
while (true)
{
if (_flag.Count < 10)
{
_flag.Enqueue(++n);
if (n == ushort.MaxValue) n = 0;
}
Thread.Sleep(5);
}
}
private bool ReConnect()
{
try
{
//初始化地址
InitAddr();
//检查IP地址
bool rtn = CheckIP(IP);
if (!rtn) return false;
_send = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
_receive = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
_flag = new System.Collections.Concurrent.ConcurrentQueue<ushort>();
//建立连接
_client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
_client.Connect(IPAddress.Parse(IP), PORT);
Thread.Sleep(100); //需要等待一会才能获取连接状态
tFlag = new Thread(new ThreadStart(Flag));
tFlag.Start();
Thread.Sleep(10);
if (_logPath == null)
_log = null;
else
_log = new LogFile(_logPath, IP);
tSend = new Thread(new ThreadStart(Send));
tReceive = new Thread(new ThreadStart(Receive));
tListen = new Thread(new ThreadStart(Listen));
tTrigger = new Thread(new ThreadStart(TriggerDIO));
tReadInput = new Thread(new ThreadStart(AutoReadInput));
tReadOutput = new Thread(new ThreadStart(AutoReadOutput));
IsConn = true;
_loop = true;
tListen.Start();
tTrigger.Start();
tSend.Start();
tReceive.Start();
tReadInput.Start();
tReadOutput.Start();
ErrInfo = "";
if (_log != null) _log.OutData("Connect OK");
return true;
}
catch (Exception ex)
{
IsConn = false;
ErrInfo = ex.Message;
if (_log != null) _log.OutError(ex.Message);
return false;
}
}
}
/// <summary>
/// IO模块类型
/// </summary>
public enum Box_Type : int
{
/// <summary>
/// 数字信号输入
/// </summary>
DI,
/// <summary>
/// 数字信号输出
/// </summary>
DO,
/// <summary>
/// 模拟量输入
/// </summary>
AI,
/// <summary>
/// 模拟量输出
/// </summary>
AO
}
/// <summary>
/// IO模块寄存器状态
/// </summary>
public enum Box_Sta : int
{
/// <summary>
/// 断开,关闭,低电平
/// </summary>
Off = 0,
/// <summary>
/// 闭合,打开,高电平
/// </summary>
On = 255
}
/// <summary>
/// 日志类型
/// </summary>
public enum LogType : int
{
/// <summary>
/// 仅错误信息
/// </summary>
OnlyError,
/// <summary>
/// 所有
/// </summary>
All
}
}
\ No newline at end of file
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Generic;
namespace Asa.IOModule
{
/// <summary>
/// AIOBOX操作类
/// </summary>
public class AIOBOX
{
private Socket _client; //客户端
private bool _quit;
private bool _loop;
private string _logPath; //日志的文件夹路径
private LogFile _log; //日志的类
private LogType _logType; //日志输出类型
private bool _frontInputOutput; //True:Input False:Output
private int countInput; //输入总数
private int countOutput; //输出总数
private int sleepInput; //自动读取DI间隔
private int sleepOutput; //自动读取DO间隔
private Box_Type _typeInput; //输入类型
private Box_Type _typeOutput; //输出类型
private byte[] _addressInput; //输入地址
private byte[] _addressOutput; //输出地址
private bool _autoReadInput; //自动读取DI
private bool _autoReadOutput; //自动读取DO
private bool _manualReadOutput; //手动读取DO
private bool _changeDI; //DI收到数据触发事件
private bool _changeDO; //DO收到数据触发事件
private bool _changeAI; //AI收到数据触发事件
private bool _changeAO; //AO收到数据触发事件
private Box_Sta[] _stateDI; //状态
private Box_Sta[] _stateDO; //状态
private int[] _valueAI; //模拟量
private int[] _valueAO; //模拟量
private System.Collections.Concurrent.ConcurrentQueue<ushort> _flag;
private System.Collections.Concurrent.ConcurrentQueue<byte[]> _send;
private System.Collections.Concurrent.ConcurrentQueue<byte[]> _receive;
private Thread tRecon;
private Thread tSend; //发送命令处理
private Thread tReceive; //接收信息处理
private Thread tListen; //监听网络
private Thread tTrigger; //触发DI、DO改变事件
private Thread tReadInput; //自动读取DI线程
private Thread tReadOutput; //自动读取DO线程
private Thread tFlag; //ModBusTCP标识
private UdpClient broadcastClient; //广播客户端
private IPEndPoint broadcastEndPoint; //广播远程节点
private byte[] broadcastBuffer; //远程返回数据
/// <summary>
/// 每条命令发送的间隔
/// 不能小于15,会出现IO接收不到的情况
/// 小于30时,会出现接收数据连包的情况
/// </summary>
private const int SEND_SLEEP = 30;
/// <summary>
/// ModBus端口
/// </summary>
public const int PORT = 502;
/// <summary>
/// 自动读取DI委托
/// </summary>
/// <param name="box">AIOBOX</param>
/// <param name="sta">所有DI状态</param>
public delegate void DIO_Changed(AIOBOX box, Box_Sta[] sta);
/// <summary>
/// 自动读取DI事件触发
/// </summary>
public event DIO_Changed DI_Changed_Event;
/// <summary>
/// 自动读取DO事件触发
/// </summary>
public event DIO_Changed DO_Changed_Event;
/// <summary>
/// 自动读取AI委托
/// </summary>
/// <param name="box">AIOBOX</param>
/// <param name="val">所有AI的值</param>
public delegate void AIO_Changed(AIOBOX box, int[] val);
/// <summary>
/// 自动读取AI事件触发
/// </summary>
public event AIO_Changed AI_Changed_Event;
/// <summary>
/// 自动读取AO事件触发
/// </summary>
public event AIO_Changed AO_Changed_Event;
/// <summary>
/// AIOBOX
/// </summary>
public AIOBOX()
{
_log = null;
_logPath = null;
_autoReadInput = false;
_autoReadOutput = false;
_manualReadOutput = false;
sleepInput = 100;
sleepOutput = 100;
}
/// <summary>
/// IP地址
/// </summary>
public string IP { set; get; } = "192.168.1.100";
/// <summary>
/// 是否连接
/// </summary>
public bool IsConn { get; private set; } = false;
/// <summary>
/// 错误信息
/// </summary>
public string ErrInfo { get; private set; } = "";
/// <summary>
/// 日志路径,连接前设置路径会自动保存日志
/// </summary>
/// <param name="path">文件夹路径</param>
/// <param name="type">输出类型</param>
public void LogPath(string path, LogType type)
{
_logPath = path;
_logType = type;
}
/// <summary>
/// 设置输入端
/// </summary>
/// <param name="type">类型</param>
/// <param name="count">数量</param>
public void SetInput(Box_Type type, int count)
{
_typeInput = type;
countInput = count;
_frontInputOutput = false;
}
/// <summary>
/// 设置输出端
/// </summary>
/// <param name="type">类型</param>
/// <param name="count">数量</param>
public void SetOutput(Box_Type type, int count)
{
_typeOutput = type;
countOutput = count;
_frontInputOutput = true;
}
/// <summary>
/// 自动获取IP地址,未连接前使用,必须在同一网段
/// </summary>
/// <param name="localIP">本地IP地址</param>
/// <returns></returns>
public bool AutoIP(string localIP)
{
try
{
IPEndPoint local = new IPEndPoint(IPAddress.Parse(localIP), 55654);
broadcastClient = new UdpClient(local);
broadcastBuffer = null;
Thread tTemp = new Thread(new ThreadStart(GetIP));
tTemp.Start();
broadcastEndPoint = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 1024);
byte[] dgram = new byte[] { 0x05, 0x00, 0x07, 0x00, 0x00, 0xC1, 0x59 };
broadcastClient.Send(dgram, dgram.Length, broadcastEndPoint);
Thread.Sleep(1000);
tTemp.Abort();
broadcastClient.Close();
ErrInfo = "无法访问";
if (broadcastBuffer == null) return false;
if (broadcastBuffer[0] != 0x3B) return false;
byte[] buff = new byte[broadcastBuffer[7]];
Array.Copy(broadcastBuffer, 9, buff, 0, buff.Length);
IP = buff[buff.Length - 12] + "." + buff[buff.Length - 11] + "." + buff[buff.Length - 10] + "." + buff[buff.Length - 9];
ErrInfo = "OK";
return true;
}
catch (Exception ex)
{
ErrInfo = ex.Message;
return false;
}
}
/// <summary>
/// 检查IP地址
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public bool CheckIP(string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
ErrInfo = "非法的IP地址";
return false;
}
//Ping服务端
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 1000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
ErrInfo = "Ping " + ip + " 请求没有响应";
return false;
}
return true;
}
/// <summary>
/// 连接
/// </summary>
public void Connect()
{
if (_logPath == null)
_log = null;
else
_log = new LogFile(_logPath, IP);
_quit = false;
tRecon = new Thread(new ThreadStart(Reconn));
tRecon.Start();
int time = 0;
while (time < 3000)
{
if (IsConn) break;
else time += 50;
Thread.Sleep(50);
}
}
/// <summary>
/// 关闭连接
/// </summary>
public void Close()
{
_quit = true;
Exit();
if (_log != null)
{
_log.OutData("Close OK");
_log.Close();
_log = null;
}
}
/// <summary>
/// 自动读取输入端并触发事件(主动上传数据 = 禁止)
/// </summary>
/// <param name="read">是否自动读取</param>
/// <param name="sleep">间隔,必须大于等于15ms</param>
public void AutoReadInput(bool read, int sleep)
{
if (countInput < 1)
_autoReadInput = false;
else if (sleep < 15)
_autoReadInput = false;
else if (read)
{
_autoReadInput = true;
sleepInput = sleep;
}
else
_autoReadInput = false;
}
/// <summary>
/// 自动读取输入端并触发事件(主动上传数据 = 使能)
/// </summary>
/// <param name="read">是否自动读取</param>
public void AutoReadInput(bool read)
{
if (countInput < 1)
_autoReadInput = false;
else if (read)
{
_autoReadInput = true;
sleepInput = 8000; //IO模块最大10s,避免超过时间,每8秒发送一次心跳包
}
else
_autoReadInput = false;
}
/// <summary>
/// 自动读取输出端,触发事件
/// </summary>
/// <param name="read">是否自动读取</param>
/// <param name="sleep">间隔,必须大于等于15ms</param>
public void AutoReadOutput(bool read, int sleep)
{
if (countOutput < 1)
{
_autoReadOutput = false;
sleepOutput = 100;
}
else if (sleep < 15)
{
_autoReadOutput = false;
sleepOutput = 100;
}
else if (read)
{
_autoReadOutput = true;
sleepOutput = sleep;
}
else
{
_autoReadOutput = false;
_manualReadOutput = true; //用于第一次连接的时候读取一次状态
sleepOutput = sleep;
}
}
/// <summary>
/// 相反状态(ON/OFF)
/// </summary>
/// <param name="sta"></param>
/// <returns></returns>
public Box_Sta ReverseStatus(Box_Sta sta)
{
return sta == Box_Sta.On ? Box_Sta.Off : Box_Sta.On;
}
/// <summary>
/// 相反状态(ON/OFF)
/// </summary>
/// <param name="sta"></param>
public void ReverseStatus(ref Box_Sta sta)
{
if (sta == Box_Sta.On)
sta = Box_Sta.Off;
else
sta = Box_Sta.On;
}
/// <summary>
/// 读取单个DI输入状态(ON/OFF)
/// </summary>
/// <param name="add">输入地址,从0开始</param>
/// <returns></returns>
public Box_Sta ReadDI(int add)
{
return _stateDI[add];
}
/// <summary>
/// 读取多个DI输入状态(ON/OFF)
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public Box_Sta[] ReadDI(int add, int count)
{
Box_Sta[] sta = new Box_Sta[count];
Array.Copy(_stateDI, add, sta, 0, count);
return sta;
}
/// <summary>
/// 读取单个AI模拟量的值
/// </summary>
/// <param name="add">模拟量地址,从0开始</param>
/// <returns></returns>
public int ReadAI(int add)
{
return _valueAI[add];
}
/// <summary>
/// 读取多个AI模拟量的值
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public int[] ReadAI(int add, int count)
{
int[] sta = new int[count];
Array.Copy(_valueAI, add, sta, 0, count);
return sta;
}
/// <summary>
/// 读取单个DO输出状态(ON/OFF)
/// </summary>
/// <param name="add">输出地址,从0开始</param>
/// <returns></returns>
public Box_Sta ReadDO(int add)
{
return _stateDO[add];
}
/// <summary>
/// 读取多个DO输出状态(ON/OFF)
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public Box_Sta[] ReadDO(int add, int count)
{
Box_Sta[] sta = new Box_Sta[count];
Array.Copy(_stateDO, add, sta, 0, count);
return sta;
}
/// <summary>
/// 读取单个AO模拟量的值
/// </summary>
/// <param name="add">输出地址,从0开始</param>
/// <returns></returns>
public int ReadAO(int add)
{
return _valueAO[add];
}
/// <summary>
/// 读取多个AO模拟量的值
/// </summary>
/// <param name="add">起始地址,从0开始</param>
/// <param name="count">数量</param>
/// <returns></returns>
public int[] ReadAO(int add, int count)
{
int[] sta = new int[count];
Array.Copy(_valueAO, add, sta, 0, count);
return sta;
}
/// <summary>
/// 写入单个DO输出状态(ON/OFF)
/// </summary>
/// <param name="add">输出地址,从0开始</param>
/// <param name="sta"></param>
/// <returns></returns>
public bool WriteDO(int add, Box_Sta sta)
{
try
{
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
buff[7] = 5; //功能码
buff[9] = _addressOutput[add]; //地址
buff[10] = (byte)sta; //写入值
_send.Enqueue(buff);
if (!_autoReadOutput)
_manualReadOutput = true;
return true;
}
catch (Exception ex)
{
ErrInfo = ex.Message;
return false;
}
}
/// <summary>
/// 获取本地IPv4地址
/// </summary>
/// <returns></returns>
public string[] GetLocalIP()
{
List<string> str = new List<string>();
IPAddress[] add = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
foreach (IPAddress ip in add)
{
if (ip.AddressFamily.ToString() == "InterNetwork")
str.Add(ip.ToString());
}
return str.ToArray();
}
/// <summary>
/// 发送命令
/// </summary>
private void Send()
{
while (_loop)
{
bool rtn = _send.TryDequeue(out byte[] result);
if (rtn)
{
try
{
_client.Send(result);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Send ", result);
}
}
catch (Exception ex)
{
IsConn = false;
_loop = false;
if (_log != null)
_log.OutError(ex.Message);
}
}
Thread.Sleep(SEND_SLEEP);
}
}
/// <summary>
/// 接收命令
/// </summary>
private void Receive()
{
while (_loop)
{
if (_receive.TryDequeue(out byte[] buff))
{
try
{
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Receive ", buff);
}
if (buff.Length < 7)
continue;
if (buff[7] == 1)
{
ReadDO(buff);
_changeDO = true;
}
else if (buff[7] == 2)
{
ReadDI(buff);
_changeDI = true;
}
else if (buff[7] == 4)
{
ReadAI(buff);
_changeAI = true;
}
else if (buff[7] == 5)
{
//ReadSingle(buff);
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
Thread.Sleep(10);
}
}
/// <summary>
/// 读取写入单个DO,功能码5
/// </summary>
/// <param name="buff"></param>
private void ReadSingle(byte[] buff)
{
string s;
//if (LogOut)
//{
// byte[] bb = new byte[2];
// bb[0] = buff[1];
// bb[1] = buff[0];
// ushort flag = BitConverter.ToUInt16(bb, 0);
// s = string.Format("{0:HH:mm:ss:fff} WriteDO {1} fun={2} len={3}", DateTime.Now, flag, buff[7], buff.Length);
// _log.Add(s);
//}
// int n = 0;
// int move = 0;
// byte val = _receive[0][9];
// for (int i = 0; i < 8; i++)
// {
// n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
// _sta[i + 16] = n == 1 ? Box_Sta.On : Box_Sta.Off;
// move++;
// }
// if (_receive[0][8] == 2)
// {
// move = 0;
// val = _receive[0][10];
// for (int i = 8; i < 16; i++)
// {
// n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
// _sta[i + 16] = n == 1 ? Box_Sta.On : Box_Sta.Off;
// move++;
// }
// }
// ErrInfo = "OK";
//}
//catch (Exception ex)
//{
// ErrInfo = ex.Message;
//}
}
/// <summary>
/// 读取所有DO状态,功能码1
/// </summary>
/// <param name="buff"></param>
private void ReadDO(byte[] buff)
{
try
{
int idx = 0;
int count = buff[8];
for (int i = 1; i <= count; i++)
{
int n = 0;
int move = 0;
byte val = buff[8 + i];
for (int j = 0; j < 8; j++)
{
n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
_stateDO[idx++] = n == 1 ? Box_Sta.On : Box_Sta.Off;
move++;
}
}
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Read All DO");
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
/// <summary>
/// 读取所有DI状态,功能码2
/// </summary>
private void ReadDI(byte[] buff)
{
try
{
int idx = 0;
int count = buff[8];
for (int i = 1; i <= count; i++)
{
int n = 0;
int move = 0;
byte val = buff[8 + i];
for (int j = 0; j < 8; j++)
{
n = (val & Convert.ToInt32(Math.Pow(2, move))) >> move;
_stateDI[idx++] = n == 1 ? Box_Sta.On : Box_Sta.Off;
move++;
}
}
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Read All DI");
}
//Test 方法锁
TestMethod();
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
/// <summary>
/// 读取所有AI的值,功能码4
/// </summary>
/// <param name="buff"></param>
private void ReadAI(byte[] buff)
{
try
{
if (countInput * 2 == buff[8])
{
_valueAI[0] = buff[9] * 256 + buff[10];
_valueAI[1] = buff[11] * 256 + buff[12];
_valueAI[2] = buff[13] * 256 + buff[14];
_valueAI[3] = buff[15] * 256 + buff[16];
}
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Read All AI");
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
}
/// <summary>
/// 命令,前7个字节
/// </summary>
/// <returns></returns>
private byte[] Command()
{
_flag.TryDequeue(out ushort result);
byte[] flag = BitConverter.GetBytes(result);
byte[] data = new byte[7];
data[0] = flag[1];
data[1] = flag[0];
data[2] = 0;
data[3] = 0;
data[4] = 0;
data[5] = 0;
data[6] = 255;
return data;
}
/// <summary>
/// 触发DIO改变事件
/// </summary>
private void TriggerDIO()
{
while (_loop)
{
if (_typeInput == Box_Type.DI && DI_Changed_Event != null)
{
//if (_changeDI)
//{
// _changeDI = false;
// Box_Sta[] staDI = new Box_Sta[countInput];
// Array.Copy(_stateDI, 0, staDI, 0, staDI.Length);
// if (_log != null)
// {
// if (_logType == LogType.All)
// _log.OutData("Trigger DI Event");
// }
// lock (staDI)
// System.Threading.Tasks.Task.Run(() => DI_Changed_Event.Invoke(this, staDI));
//}
}
else if (_typeInput == Box_Type.AI && AI_Changed_Event != null)
{
if (_changeAI)
{
_changeAI = false;
int[] valAI = new int[countInput];
Array.Copy(_valueAI, 0, valAI, 0, valAI.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger AI Event");
}
lock (valAI)
System.Threading.Tasks.Task.Run(() => AI_Changed_Event.Invoke(this, valAI));
}
}
if (_typeOutput == Box_Type.DO && DO_Changed_Event != null)
{
if (_changeDO)
{
_changeDO = false;
Box_Sta[] staDO = new Box_Sta[countOutput];
Array.Copy(_stateDO, 0, staDO, 0, staDO.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger DO Event");
}
lock (staDO)
System.Threading.Tasks.Task.Run(() => DO_Changed_Event.Invoke(this, staDO));
}
}
else if (_typeOutput == Box_Type.AO && AO_Changed_Event != null)
{
if (_changeAO)
{
_changeAO = false;
int[] valAO = new int[countOutput];
Array.Copy(_valueAO, 0, valAO, 0, valAO.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger AO Event");
}
lock (valAO)
System.Threading.Tasks.Task.Run(() => AO_Changed_Event.Invoke(this, valAO));
}
}
Thread.Sleep(10);
}
}
/// <summary>
/// 自动读取输入端线程
/// </summary>
private void AutoReadInput()
{
while (_loop)
{
if (IsConn && _autoReadInput)
{
//if (suspendDI && suspend > 0)
//{
// suspendDI = false;
// suspend--;
//}
//else
//{
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
//功能码
if (_typeInput == Box_Type.DI)
buff[7] = 2;
else if (_typeInput == Box_Type.AI)
buff[7] = 4;
buff[9] = _addressInput[0]; //地址
buff[11] = (byte)countInput; //个数
_send.Enqueue(buff);
//suspendDI = true;
//}
}
Thread.Sleep(sleepInput);
}
}
/// <summary>
/// 自动读取输出端线程
/// </summary>
private void AutoReadOutput()
{
while (_loop)
{
Thread.Sleep(sleepOutput);
if (!IsConn) continue;
if (!_autoReadOutput)
{
if (_manualReadOutput)
_manualReadOutput = false;
else
continue;
}
byte[] data = Command();
byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
buff[7] = 1; //功能码
buff[9] = _addressOutput[0]; //地址
buff[11] = (byte)countOutput; //个数
_send.Enqueue(buff);
}
}
/// <summary>
/// 监听结果线程
/// </summary>
private void Listen()
{
byte[] temp = new byte[200];
int start, len;
while (_loop)
{
try
{
if (_client == null) break;
if (_client.Available > 0)
{
start = 0;
int count = _client.Receive(temp);
while (count - start > 6)
{
len = temp[start + 5];
len += 6;
if (start + len > count) break;
byte[] aa = new byte[len];
Array.Copy(temp, start, aa, 0, len);
_receive.Enqueue(aa);
start += len;
}
}
}
catch (Exception ex)
{
IsConn = false;
_loop = false;
if (_log != null)
_log.OutError(ex.Message);
}
Thread.Sleep(10);
}
}
private void InitAddr()
{
byte n = 0;
if (_frontInputOutput)
{
_addressInput = new byte[countInput];
for (int i = 0; i < countInput; i++)
_addressInput[i] = n++;
_addressOutput = new byte[countOutput];
for (int i = 0; i < countOutput; i++)
_addressOutput[i] = n++;
}
else
{
_addressOutput = new byte[countOutput];
for (int i = 0; i < countOutput; i++)
_addressOutput[i] = n++;
_addressInput = new byte[countInput];
for (int i = 0; i < countInput; i++)
_addressInput[i] = n++;
}
_stateDI = new Box_Sta[countInput];
_stateDO = new Box_Sta[countOutput];
_valueAI = new int[countInput];
_valueAO = new int[countOutput];
}
private void GetIP()
{
broadcastBuffer = broadcastClient.Receive(ref broadcastEndPoint);
}
private void Flag()
{
ushort n = 0;
while (_loop)
{
if (_flag.Count < 10)
{
_flag.Enqueue(++n);
if (n == ushort.MaxValue) n = 0;
}
Thread.Sleep(5);
}
}
private void Open()
{
try
{
//初始化地址
IsConn = false;
InitAddr();
//检查IP地址
bool rtn = CheckIP(IP);
if (!rtn) return;
_send = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
_receive = new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
_flag = new System.Collections.Concurrent.ConcurrentQueue<ushort>();
//建立连接
_client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
_client.Connect(IPAddress.Parse(IP), PORT);
Thread.Sleep(100); //需要等待一会才能获取连接状态
tFlag = new Thread(new ThreadStart(Flag));
tFlag.Start();
Thread.Sleep(10);
tSend = new Thread(new ThreadStart(Send));
tReceive = new Thread(new ThreadStart(Receive));
tListen = new Thread(new ThreadStart(Listen));
tTrigger = new Thread(new ThreadStart(TriggerDIO));
tReadInput = new Thread(new ThreadStart(AutoReadInput));
tReadOutput = new Thread(new ThreadStart(AutoReadOutput));
IsConn = true;
_loop = true;
tListen.Start();
tTrigger.Start();
tSend.Start();
tReceive.Start();
tReadInput.Start();
tReadOutput.Start();
ErrInfo = "";
if (_log != null) _log.OutData("Connect OK");
return;
}
catch (Exception ex)
{
IsConn = false;
ErrInfo = ex.Message;
if (_log != null) _log.OutError(ex.Message);
return;
}
}
private void Exit()
{
IsConn = false;
_loop = false;
tListen = null;
tReadInput = null;
tReadOutput = null;
tTrigger = null;
tSend = null;
tReceive = null;
tFlag = null;
try
{
if (_client != null)
{
_client.Shutdown(SocketShutdown.Both);
_client.Close();
}
}
catch (Exception ex)
{
if (_log != null)
_log.OutError(ex.Message);
}
finally
{
_client = null;
}
}
/// <summary>
/// 测试方法锁
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.Synchronized)]
private void TestMethod()
{
Box_Sta[] staDI = new Box_Sta[countInput];
Array.Copy(_stateDI, 0, staDI, 0, staDI.Length);
if (_log != null)
{
if (_logType == LogType.All)
_log.OutData("Trigger DI Event");
}
lock (staDI)
System.Threading.Tasks.Task.Run(() => DI_Changed_Event.Invoke(this, staDI));
}
private void Reconn()
{
while (!_quit)
{
if (IsConn)
{
Thread.Sleep(1000);
}
else
{
Exit();
Thread.Sleep(100);
if (!_quit) Open();
}
}
}
}
/// <summary>
/// IO模块类型
/// </summary>
public enum Box_Type : int
{
/// <summary>
/// 数字信号输入
/// </summary>
DI,
/// <summary>
/// 数字信号输出
/// </summary>
DO,
/// <summary>
/// 模拟量输入
/// </summary>
AI,
/// <summary>
/// 模拟量输出
/// </summary>
AO
}
/// <summary>
/// IO模块寄存器状态
/// </summary>
public enum Box_Sta : int
{
/// <summary>
/// 断开,关闭,低电平
/// </summary>
Off = 0,
/// <summary>
/// 闭合,打开,高电平
/// </summary>
On = 255
}
/// <summary>
/// 日志类型
/// </summary>
public enum LogType : int
{
/// <summary>
/// 仅错误信息
/// </summary>
OnlyError,
/// <summary>
/// 所有
/// </summary>
All
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{64600160-A389-4B09-AF59-A4C9ACA039DE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa.AIOBOX</RootNamespace>
<AssemblyName>Asa.IOModule.AIOBOX</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Asa.IOModule.AIOBOX.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Asa.IOModule.AIOBOX.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AIOBOX.cs" />
<Compile Include="Log.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
此文件类型无法预览
using System;
using System.Reflection;
using System.Diagnostics;
namespace Asa.IOModule
{
/// <summary>
/// 日志操作类
/// </summary>
internal class LogFile
{
//private string args;
private bool loop;
private System.IO.FileStream fs;
private StackTrace trace;
private StackFrame frame;
private MethodBase method;
private System.Threading.Thread tSave;
private System.Collections.Concurrent.ConcurrentQueue<string> info;
private readonly string PATH;
/// <summary>
/// 日志
/// </summary>
/// <param name="path">文件夹路径</param>
/// <param name="ip"></param>
internal LogFile(string path, string ip)
{
if (path == null) return;
//this.args = ip;
PATH = path.EndsWith("\\") ? path : path + "\\";
if (!System.IO.Directory.Exists(PATH))
System.IO.Directory.CreateDirectory(PATH);
loop = true;
tSave = new System.Threading.Thread(new System.Threading.ThreadStart(SaveLog));
info = new System.Collections.Concurrent.ConcurrentQueue<string>();
tSave.Start();
string file = string.Format("{0}{1:yyyy-MM-dd}_({2}).log", PATH, DateTime.Now, ip);
fs = System.IO.File.OpenWrite(file);
fs.Position = fs.Length;
}
/// <summary>
/// 关闭文件
/// </summary>
internal void Close()
{
loop = false;
System.Threading.Thread.Sleep(5);
if (fs != null)
fs.Close();
}
/// <summary>
/// 输出错误
/// </summary>
/// <param name="s"></param>
internal void OutError(string s)
{
if (string.IsNullOrWhiteSpace(s)) return;
trace = new StackTrace(true);
frame = trace.GetFrame(1);
string name = frame.GetFileName();
name = System.IO.Path.GetFileName(name);
string log = string.Format("[{0:HH:mm:ss.fff}] ERROR {1}({2},{3})\r\n",
DateTime.Now, name, frame.GetFileLineNumber(), frame.GetFileColumnNumber());
string[] arr = new string[trace.FrameCount - 1];
for (int i = 1; i < trace.FrameCount; i++) //0是本身Out
{
method = trace.GetFrame(i).GetMethod();
arr[arr.Length - i] = " " + method.DeclaringType.FullName + " -> " + method.ToString();
}
log += string.Join("\r\n", arr) + string.Format("\r\n {0}\r\n", s);
//byte[] array = System.Text.Encoding.UTF8.GetBytes(log);
//fs.Write(array, 0, array.Length);
info.Enqueue(log);
}
/// <summary>
/// 输出信息
/// </summary>
/// <param name="s"></param>
internal void OutInfo(string s)
{
if (string.IsNullOrWhiteSpace(s)) return;
trace = new StackTrace(true);
frame = trace.GetFrame(1);
method = trace.GetFrame(1).GetMethod();
string name = frame.GetFileName();
name = System.IO.Path.GetFileName(name);
string s1 = method.DeclaringType.FullName;
string s2 = method.Name;
string log = string.Format("[{0:HH:mm:ss.fff}] INFO {1}({2},{3}) {4} -> {5}\r\n {6}\r\n",
DateTime.Now, name, frame.GetFileLineNumber(), frame.GetFileColumnNumber(), s1, s2, s);
//byte[] array = System.Text.Encoding.UTF8.GetBytes(log);
//fs.Write(array, 0, array.Length);
info.Enqueue(log);
}
/// <summary>
/// 输出数据
/// </summary>
/// <param name="tr"></param>
/// <param name="buff"></param>
internal void OutData(string tr, byte[] buff)
{
string log = string.Format("{0:HH:mm:ss.fff} {1} ", DateTime.Now, tr);
for (int i = 0; i < buff.Length; i++)
log += buff[i].ToString("X2") + " ";
log += "\r\n";
//byte[] array = System.Text.Encoding.UTF8.GetBytes(log);
//fs.Write(array, 0, array.Length);
info.Enqueue(log);
}
/// <summary>
/// 输出数据
/// </summary>
/// <param name="s"></param>
internal void OutData(string s)
{
string log = string.Format("{0:HH:mm:ss.fff} {1}\r\n", DateTime.Now, s);
//byte[] array = System.Text.Encoding.UTF8.GetBytes(log);
//fs.Write(array, 0, array.Length);
info.Enqueue(log);
}
internal void SaveLog()
{
while (loop)
{
try
{
if (info.TryDequeue(out string result))
{
byte[] array = System.Text.Encoding.UTF8.GetBytes(result);
fs.Write(array, 0, array.Length);
}
}
catch (Exception)
{ }
System.Threading.Thread.Sleep(2);
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AIOBOX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AIOBOX")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("e8d77b2a-a00d-4618-987d-c8a7ddd41b0b")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.1.0")]
[assembly: AssemblyFileVersion("2.3.1.0")]
<?xml version="1.0"?>
<doc>
<assembly>
<name>Asa.IOModule.AIOBOX</name>
</assembly>
<members>
<member name="T:Asa.IOModule.AIOBOX">
<summary>
AIOBOX操作类
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.SEND_SLEEP">
<summary>
每条命令发送的间隔
不能小于15,会出现IO接收不到的情况
小于30时,会出现接收数据连包的情况
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.PORT">
<summary>
ModBus端口
</summary>
</member>
<member name="T:Asa.IOModule.AIOBOX.DIO_Changed">
<summary>
自动读取DI委托
</summary>
<param name="box">AIOBOX</param>
<param name="sta">所有DI状态</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.DI_Changed_Event">
<summary>
自动读取DI事件触发
</summary>
</member>
<member name="E:Asa.IOModule.AIOBOX.DO_Changed_Event">
<summary>
自动读取DO事件触发
</summary>
</member>
<member name="T:Asa.IOModule.AIOBOX.AIO_Changed">
<summary>
自动读取AI委托
</summary>
<param name="box">AIOBOX</param>
<param name="val">所有AI的值</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.AI_Changed_Event">
<summary>
自动读取AI事件触发
</summary>
</member>
<member name="E:Asa.IOModule.AIOBOX.AO_Changed_Event">
<summary>
自动读取AO事件触发
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.#ctor">
<summary>
AIOBOX
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.IP">
<summary>
IP地址
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.IsConn">
<summary>
是否连接
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.ErrInfo">
<summary>
错误信息
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.LogPath(System.String,Asa.IOModule.LogType)">
<summary>
日志路径,连接前设置路径会自动保存日志
</summary>
<param name="path">文件夹路径</param>
<param name="type">输出类型</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetInput(Asa.IOModule.Box_Type,System.Int32)">
<summary>
设置输入端
</summary>
<param name="type">类型</param>
<param name="count">数量</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetOutput(Asa.IOModule.Box_Type,System.Int32)">
<summary>
设置输出端
</summary>
<param name="type">类型</param>
<param name="count">数量</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoIP(System.String)">
<summary>
自动获取IP地址,未连接前使用,必须在同一网段
</summary>
<param name="localIP">本地IP地址</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.CheckIP(System.String)">
<summary>
检查IP地址
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Connect">
<summary>
连接
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Close">
<summary>
关闭连接
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput(System.Boolean,System.Int32)">
<summary>
自动读取输入端并触发事件(主动上传数据 = 禁止)
</summary>
<param name="read">是否自动读取</param>
<param name="sleep">间隔,必须大于等于15ms</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput(System.Boolean)">
<summary>
自动读取输入端并触发事件(主动上传数据 = 使能)
</summary>
<param name="read">是否自动读取</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadOutput(System.Boolean,System.Int32)">
<summary>
自动读取输出端,触发事件
</summary>
<param name="read">是否自动读取</param>
<param name="sleep">间隔,必须大于等于15ms</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReverseStatus(Asa.IOModule.Box_Sta)">
<summary>
相反状态(ON/OFF)
</summary>
<param name="sta"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReverseStatus(Asa.IOModule.Box_Sta@)">
<summary>
相反状态(ON/OFF)
</summary>
<param name="sta"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Int32)">
<summary>
读取单个DI输入状态(ON/OFF)
</summary>
<param name="add">输入地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Int32,System.Int32)">
<summary>
读取多个DI输入状态(ON/OFF)
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Int32)">
<summary>
读取单个AI模拟量的值
</summary>
<param name="add">模拟量地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Int32,System.Int32)">
<summary>
读取多个AI模拟量的值
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Int32)">
<summary>
读取单个DO输出状态(ON/OFF)
</summary>
<param name="add">输出地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Int32,System.Int32)">
<summary>
读取多个DO输出状态(ON/OFF)
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAO(System.Int32)">
<summary>
读取单个AO模拟量的值
</summary>
<param name="add">输出地址,从0开始</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAO(System.Int32,System.Int32)">
<summary>
读取多个AO模拟量的值
</summary>
<param name="add">起始地址,从0开始</param>
<param name="count">数量</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.WriteDO(System.Int32,Asa.IOModule.Box_Sta)">
<summary>
写入单个DO输出状态(ON/OFF)
</summary>
<param name="add">输出地址,从0开始</param>
<param name="sta"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.GetLocalIP">
<summary>
获取本地IPv4地址
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Send">
<summary>
发送命令
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Receive">
<summary>
接收命令
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadSingle(System.Byte[])">
<summary>
读取写入单个DO,功能码5
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Byte[])">
<summary>
读取所有DO状态,功能码1
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Byte[])">
<summary>
读取所有DI状态,功能码2
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Byte[])">
<summary>
读取所有AI的值,功能码4
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.Command">
<summary>
命令,前7个字节
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.TriggerDIO">
<summary>
触发DIO改变事件
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput">
<summary>
自动读取输入端线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadOutput">
<summary>
自动读取输出端线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Listen">
<summary>
监听结果线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.TestMethod">
<summary>
测试方法锁
</summary>
</member>
<member name="T:Asa.IOModule.Box_Type">
<summary>
IO模块类型
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.DI">
<summary>
数字信号输入
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.DO">
<summary>
数字信号输出
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.AI">
<summary>
模拟量输入
</summary>
</member>
<member name="F:Asa.IOModule.Box_Type.AO">
<summary>
模拟量输出
</summary>
</member>
<member name="T:Asa.IOModule.Box_Sta">
<summary>
IO模块寄存器状态
</summary>
</member>
<member name="F:Asa.IOModule.Box_Sta.Off">
<summary>
断开,关闭,低电平
</summary>
</member>
<member name="F:Asa.IOModule.Box_Sta.On">
<summary>
闭合,打开,高电平
</summary>
</member>
<member name="T:Asa.IOModule.LogType">
<summary>
日志类型
</summary>
</member>
<member name="F:Asa.IOModule.LogType.OnlyError">
<summary>
仅错误信息
</summary>
</member>
<member name="F:Asa.IOModule.LogType.All">
<summary>
所有
</summary>
</member>
<member name="T:Asa.IOModule.LogFile">
<summary>
日志操作类
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.#ctor(System.String,System.String)">
<summary>
日志
</summary>
<param name="path">文件夹路径</param>
<param name="ip"></param>
</member>
<member name="M:Asa.IOModule.LogFile.Close">
<summary>
关闭文件
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.OutError(System.String)">
<summary>
输出错误
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutInfo(System.String)">
<summary>
输出信息
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String,System.Byte[])">
<summary>
输出数据
</summary>
<param name="tr"></param>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String)">
<summary>
输出数据
</summary>
<param name="s"></param>
</member>
</members>
</doc>
C:\Company_Tools\DLL\AIOBOX\obj\Debug\AIOBOX.csproj.CoreCompileInputs.cache
C:\Company_Tools\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\Company_Tools\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\Company_Tools\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\Company_Tools\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
C:\Company_Tools\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
C:\Company_Tools\DLL\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
C:\MY\Project\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\MY\Project\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\MY\Project\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\MY\Project\DLL\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
C:\MY\Project\DLL\AIOBOX\obj\Debug\AIOBOX.csproj.CoreCompileInputs.cache
C:\MY\Project\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
C:\MY\Project\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
C:\MyProject\DLL\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
C:\MyProject\DLL\AIOBOX\obj\Debug\AIOBOX.csproj.CoreCompileInputs.cache
C:\MyProject\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
C:\MyProject\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
C:\MyProject\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\MyProject\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\MyProject\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\MY\DLL Coding\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\MY\DLL Coding\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\MY\DLL Coding\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\MY\DLL Coding\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
C:\MY\DLL Coding\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
C:\MY\DLL Coding\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
C:\SMD\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
C:\SMD\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
C:\SMD\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
C:\SMD\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
C:\SMD\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
C:\SMD\DLL\AIOBOX\obj\Debug\AIOBOX.csprojAssemblyReference.cache
C:\SMD\DLL\AIOBOX\obj\Debug\AIOBOX.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX\obj\Debug\AIOBOX.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\DLL\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_old\bin\Debug\Asa.IOModule.AIOBOX.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_old\bin\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_old\bin\Debug\Asa.IOModule.AIOBOX.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_old\obj\Debug\AIOBOX_old.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_old\obj\Debug\Asa.IOModule.AIOBOX.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX_old\obj\Debug\Asa.IOModule.AIOBOX.pdb
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!