Commit e88c2f15 顾剑亮

上传代码

1 个父辈 cbcd77fe
正在显示 80 个修改的文件 包含 2096 行增加6 行删除
此文件类型无法预览
...@@ -5,16 +5,42 @@ VisualStudioVersion = 16.0.30011.22 ...@@ -5,16 +5,42 @@ VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIOBOX", "AIOBOX\AIOBOX.csproj", "{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIOBOX", "AIOBOX\AIOBOX.csproj", "{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}"
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {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|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.ActiveCfg = Release|Any CPU
{E8D77B2A-A00D-4618-987D-C8A7DDD41B0B}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -274,6 +274,7 @@ namespace Asa.IOModule ...@@ -274,6 +274,7 @@ namespace Asa.IOModule
byte[] data = Command(); byte[] data = Command();
byte[] buff = new byte[12]; byte[] buff = new byte[12];
Array.Copy(data, 0, buff, 0, data.Length); Array.Copy(data, 0, buff, 0, data.Length);
buff[5] = 6; //后面字节数
buff[7] = 5; //功能码 buff[7] = 5; //功能码
buff[9] = _addressOutput[add]; //地址 buff[9] = _addressOutput[add]; //地址
buff[10] = (byte)sta; //写入值 buff[10] = (byte)sta; //写入值
...@@ -376,6 +377,7 @@ namespace Asa.IOModule ...@@ -376,6 +377,7 @@ namespace Asa.IOModule
try try
{ {
_client.Send(buff); _client.Send(buff);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -68,8 +68,7 @@ ...@@ -68,8 +68,7 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>if not exist "C:\DLL\$(ProjectName)" md "C:\DLL\$(ProjectName)" <PostBuildEvent>copy "$(TargetPath)" "D:\OneDrive - 上海挚锦科技有限公司\DLL\AIOBOX\$(TargetFileName)"
copy "$(TargetPath)" "C:\DLL\$(ProjectName)\$(TargetFileName)" copy "$(TargetDir)$(TargetName).xml" "D:\OneDrive - 上海挚锦科技有限公司\DLL\AIOBOX\$(TargetName).xml"</PostBuildEvent>
copy "$(TargetDir)$(TargetName).xml" "C:\DLL\$(ProjectName)\$(TargetName).xml"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
\ No newline at end of file \ No newline at end of file
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0.6")] [assembly: AssemblyVersion("2.4.0.0")]
[assembly: AssemblyFileVersion("2.3.0.6")] [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.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\bin\Debug\Asa.IOModule.AIOBOX.dll 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\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\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.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AIOBOX\AIOBOX\obj\Debug\Asa.IOModule.AIOBOX.pdb 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 \ 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 \ 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 \ 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 \ 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 \ 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 \ 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 \ 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 \ 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 \ No newline at end of file
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
此文件的差异被折叠, 点击展开。
<?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 \ 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 \ 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")]
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!