Commit 2afe1e0f 顾剑亮

xray

1 个父辈 485c9ec3
正在显示 64 个修改的文件 包含 1161 行增加431 行删除
...@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30104.148 ...@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30104.148
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalcSize", "CalcSize\CalcSize.csproj", "{1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalcSize", "CalcSize\CalcSize.csproj", "{1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalcSize_Test", "CalcSize_Test\CalcSize_Test.csproj", "{006E606C-720F-4F8E-9A32-16684EF6B9C8}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -15,6 +17,10 @@ Global ...@@ -15,6 +17,10 @@ Global
{1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}.Debug|Any CPU.Build.0 = Debug|Any CPU {1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}.Release|Any CPU.ActiveCfg = Release|Any CPU {1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}.Release|Any CPU.Build.0 = Release|Any CPU {1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}.Release|Any CPU.Build.0 = Release|Any CPU
{006E606C-720F-4F8E-9A32-16684EF6B9C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{006E606C-720F-4F8E-9A32-16684EF6B9C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{006E606C-720F-4F8E-9A32-16684EF6B9C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{006E606C-720F-4F8E-9A32-16684EF6B9C8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>1ecda4e0-e1bf-4b1c-9a1f-e012d7590358</ProjectGuid> <ProjectGuid>{1ECDA4E0-E1BF-4B1C-9A1F-E012D7590358}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CalcSize</RootNamespace> <RootNamespace>CalcSize</RootNamespace>
...@@ -31,24 +31,28 @@ ...@@ -31,24 +31,28 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System"/> <Reference Include="OpenCvSharp">
<HintPath>..\..\..\..\DLL\OpenCvSharp\OpenCvSharp.dll</HintPath>
<Reference Include="System.Core"/> </Reference>
<Reference Include="System.Xml.Linq"/> <Reference Include="OpenCvSharp.Blob">
<Reference Include="System.Data.DataSetExtensions"/> <HintPath>..\..\..\..\DLL\OpenCvSharp\OpenCvSharp.Blob.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Extensions">
<Reference Include="Microsoft.CSharp"/> <HintPath>..\..\..\..\DLL\OpenCvSharp\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Data"/> <Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http"/> <Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml"/> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Class1.cs" /> <Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file \ No newline at end of file
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.IO;
using System.Text; using OpenCvSharp;
using System.Threading.Tasks;
namespace Asa namespace Asa
{ {
public class CalcSize public class CalcSize
{ {
private string _path;
private Mat src, gray, gauss, binary, erode;
public CalcSize()
{
_path = "";
src = new Mat();
gray = new Mat();
gauss = new Mat();
binary = new Mat();
erode = new Mat();
}
public void LoadImage(string filePath)
{
src = new Mat(filePath);
_path = System.IO.Path.GetDirectoryName(filePath) + "\\";
}
public void LoadImage(System.Drawing.Bitmap bmp)
{
src = BitmapToMat(bmp);
}
public void LoadImage(string path1, string path2)
{
Mat m1 = new Mat(path1);
Mat m2 = new Mat(path2);
Mat m3 = new Mat(m1.Size(), m1.Type());
Cv2.Absdiff(m1, m2, m3);
Cv2.NamedWindow("Absdiff", WindowMode.KeepRatio);
Cv2.ImShow("Absdiff", m3);
}
public void Find()
{
int n = 0;
string s;
Mat element1 = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(6, 6));
//Mat element2 = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(2, 2));
//灰度
Cv2.CvtColor(src, gray, ColorConversionCodes.RGB2GRAY, 0);
//s = "gray";
//gray.SaveImage(_path + s + ".jpg");
//Cv2.NamedWindow(s, WindowMode.KeepRatio);
//Cv2.ImShow(s, gray);
//高斯模糊
Cv2.GaussianBlur(gray, gauss, new OpenCvSharp.Size(5, 5), 0);
//s = "gauss";
//gauss.SaveImage(_path + s + ".jpg");
//Cv2.NamedWindow(s, WindowMode.KeepRatio);
//Cv2.ImShow(s, gauss);
//二值化
Cv2.Threshold(gauss, binary, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
//s = "binary";
//binary.SaveImage(_path + s + ".jpg");
//Cv2.NamedWindow(s, WindowMode.KeepRatio);
//Cv2.ImShow(s, binary);
//腐蚀
Cv2.Erode(binary, erode, element1);
//s = "erode";
//erode.SaveImage(_path + s + ".jpg");
//Cv2.NamedWindow(s, WindowMode.KeepRatio);
//Cv2.ImShow(s, erode);
//膨胀
//Cv2.Dilate(binary, binary, element2);
//Cv2.ImShow("Dilate", binary);
//多边形边缘
List<OpenCvSharp.Point[]> contoursList = new List<Point[]>();
List<HierarchyIndex> hierarchyList = new List<HierarchyIndex>();
Cv2.FindContours(erode, out OpenCvSharp.Point[][] contours, out HierarchyIndex[] hierarchy, RetrievalModes.CComp, ContourApproximationModes.ApproxSimple, null);
for (int i = 0; i < hierarchy.Length; i++)
{
//面积小于100
if (Cv2.ContourArea(contours[i]) < 500) continue;
RotatedRect rect1 = Cv2.MinAreaRect(contours[i]);
float w = rect1.Size.Width;
float h = rect1.Size.Height;
float rate = Math.Min(w, h) / Math.Max(w, h);
//超过原图1/3的去除
//if (w > src.Width / 3 && h > src.Height / 3)
// continue;
//宽高比例小于85%
if (rate < 0.85) continue;
//用多边形包围轮廓
contours[i] = Cv2.ApproxPolyDP(contours[i], 6, true);
//多边形小于4个角
if (contours[i].Length < 4) continue;
//多边形大于6个角,码有时不完整
//if (contours[i].Length > 8) continue;
contoursList.Add(contours[i]);
hierarchyList.Add(hierarchy[i]);
//Cv2.DrawContours(src, contours, i, Scalar.Red, 1, LineTypes.Link8, hierarchy, 0, null);
}
//s = "final";
//src.SaveImage(_path + s + ".jpg");
//Cv2.NamedWindow(s, WindowMode.KeepRatio);
//Cv2.ImShow(s, src);
//return;
for (int i = 0; i < hierarchyList.Count; i++)
{
//在图片上画出边缘
Cv2.DrawContours(src, contoursList, i, Scalar.Red, 1, LineTypes.Link8, hierarchyList, 0, null);
//整个区域的外接矩形
Rect rect2 = Cv2.BoundingRect(contoursList[i]);
//扩大一点范围,防止二维码没有全部在里面
if (rect2.X > 10) rect2.X -= 10;
if (rect2.Y > 10) rect2.Y -= 10;
rect2.Width += 20;
rect2.Height += 20;
//外接矩形
Mat code = new Mat(gray, rect2);
//code.SaveImage(_path + "code_" + (i + 1).ToString() + ".jpg");
//感兴趣区域
Mat roi = new Mat(rect2.Size, MatType.CV_8U);
roi.SetTo(0);
for (int j = 0; j < contoursList[i].Length; j++)
{
contoursList[i][j].X -= rect2.X;
contoursList[i][j].Y -= rect2.Y;
}
Cv2.DrawContours(roi, contoursList, i, Scalar.White, -1);
//roi.SaveImage(_path + "roi_" + (i + 1).ToString() + ".jpg");
Mat tttt = new Mat(rect2.Size, MatType.CV_8U);
tttt.SetTo(255);
code.CopyTo(tttt, roi); //ROI白色区域复制
string aa = @"C:\Users\neotel\Desktop\Temp\roi_" + (i + 1).ToString() + ".jpg";
tttt.SaveImage(aa);
//System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(aa);
//s = Decode(bmp);
//rtn.Add(s);
}
s = "final";
//src.SaveImage(_path + s + ".jpg");
Cv2.NamedWindow(s, WindowMode.KeepRatio);
Cv2.ImShow(s, src);
}
//public string Decode(System.Drawing.Bitmap bmp)
//{
// ZXing.Common.DecodingOptions opt = new ZXing.Common.DecodingOptions
// {
// CharacterSet = "UTF-8",
// PossibleFormats = new System.Collections.Generic.List<ZXing.BarcodeFormat>()
// {
// ZXing.BarcodeFormat.QR_CODE,
// ZXing.BarcodeFormat.DATA_MATRIX,
// ZXing.BarcodeFormat.PDF_417,
// ZXing.BarcodeFormat.AZTEC,
// ZXing.BarcodeFormat.CODE_128,
// ZXing.BarcodeFormat.CODE_39,
// ZXing.BarcodeFormat.EAN_8,
// ZXing.BarcodeFormat.EAN_13
// }
// };
// ZXing.BarcodeReader reader = new ZXing.BarcodeReader { Options = opt };
// //ZXing.Result[] result = reader.DecodeMultiple(bmp);
// ZXing.Result result = reader.Decode(bmp);
// if (result == null)
// return "";
// else
// return result.Text;
//}
public System.Drawing.Bitmap MatToBitmap(Mat dst)
{
return new System.Drawing.Bitmap(dst.Cols, dst.Rows, (int)dst.Step(), System.Drawing.Imaging.PixelFormat.Format24bppRgb, dst.Data);
}
public Mat BitmapToMat(System.Drawing.Bitmap bmp)
{
int w = bmp.Width;
int h = bmp.Height;
int len = w * h * 3;
byte[] result = new byte[len];
int step;
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(0, 0, w, h);
System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat);
IntPtr iPtr = bmpData.Scan0;
System.Runtime.InteropServices.Marshal.Copy(iPtr, result, 0, len);
step = bmpData.Stride;
bmp.UnlockBits(bmpData);
return new Mat(bmp.Height, bmp.Width, new MatType(MatType.CV_8UC3), result, step);
}
} }
} }
\ 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.1" />
</startup>
</configuration>
\ No newline at end of file \ 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>{006E606C-720F-4F8E-9A32-16684EF6B9C8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CalcSize_Test</RootNamespace>
<AssemblyName>CalcSize_Test</AssemblyName>
<TargetFrameworkVersion>v4.6.1</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>
<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="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.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="..\CalcSize\CalcSize.csproj">
<Project>{1ecda4e0-e1bf-4b1c-9a1f-e012d7590358}</Project>
<Name>CalcSize</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
namespace CalcSize_Test
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button3 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button3
//
this.button3.Location = new System.Drawing.Point(148, 12);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(130, 50);
this.button3.TabIndex = 7;
this.button3.Text = "相减";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 68);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(670, 225);
this.textBox1.TabIndex = 6;
//
// button2
//
this.button2.Location = new System.Drawing.Point(399, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(130, 50);
this.button2.TabIndex = 5;
this.button2.Text = "解码";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(130, 50);
this.button1.TabIndex = 4;
this.button1.Text = "查找";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.button3);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
}
}
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 CalcSize_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() != DialogResult.OK) return;
Asa.CalcSize code = new Asa.CalcSize();
code.LoadImage(dlg.FileName);
code.Find();
}
private void button3_Click(object sender, EventArgs e)
{
string path1 = @"C:\Users\neotel\Desktop\Temp\Image-0.bmp";
string path2 = @"C:\Users\neotel\Desktop\Temp\Image-2.bmp";
Asa.CalcSize code = new Asa.CalcSize();
code.LoadImage(path1, path2);
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() != DialogResult.OK) return;
//Bitmap bmp = new Bitmap(dlg.FileName);
//Asa.CalcSize code = new Asa.CalcSize();
//string s = code.Decode(bmp);
//MessageBox.Show(s);
}
}
}
<?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 CalcSize_Test
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("CalcSize_Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CalcSize_Test")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("006e606c-720f-4f8e-9a32-16684ef6b9c8")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [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 CalcSize_Test.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("CalcSize_Test.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 CalcSize_Test.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>
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Asa namespace Asa
{ {
...@@ -161,9 +156,10 @@ namespace Asa ...@@ -161,9 +156,10 @@ namespace Asa
internal void Process([In, Out] int nEventID, [In, Out] API.CR_Event pEvent) internal void Process(int nEventID, [In, Out] API.CR_Event pEvent)
{ {
Debug.Print("nEventID=" + nEventID); Debug.Print("nEventID=" + nEventID);
//pEvent = IntPtr.Zero;
} }
...@@ -176,8 +172,15 @@ namespace Asa ...@@ -176,8 +172,15 @@ namespace Asa
//rtn = API.CR_RegisterEventCallback(pCallback); //rtn = API.CR_RegisterEventCallback(pCallback);
API.CallbackDelegate callback = Process; //API.CallbackDelegate callback = new API.CallbackDelegate(Process);
rtn = API.CR_RegisterEventCallback(callback); //API.CallbackDelegate callback = Process;
//rtn = API.CR_RegisterEventCallbackFun(callback);
//API.CallbackDelegate callback = new API.CallbackDelegate(new CCallbackImp().Process);
//rtn = API.CR_RegisterEventCallback(callback);
...@@ -225,13 +228,38 @@ namespace Asa ...@@ -225,13 +228,38 @@ namespace Asa
rtn = API.CR_SetApplicationMode(idx, pModeInfo[2].nModeID); //rtn = API.CR_SetApplicationMode(idx, pModeInfo[2].nModeID);
float pFrameRate = 1.2f;
int pExposureTime = 1000;
rtn = API.CR_SetApplicationModeWithParam(idx, 103, ref pFrameRate, ref pExposureTime, 9, 6);
byte[] buff = new byte[WIDTH * HEIGHT * 2 + HEAD]; byte[] buff = new byte[WIDTH * HEIGHT * 2 + HEAD];
rtn = API.CR_StartAcquisition(idx, 1, ref buff); for (int i = 0; i < buff.Length; i++)
System.Threading.Thread.Sleep(2000); buff[i] = 255;
rtn = API.CR_StartAcquisition(idx, 1, buff);
System.Threading.Thread.Sleep(3000);
rtn = API.CR_StopAcquisition(idx); rtn = API.CR_StopAcquisition(idx);
src = buff;
//byte[] buff = new byte[WIDTH * HEIGHT * 2 + HEAD];
//IntPtr ptr = new IntPtr();
//rtn = API.CR_StartAcquisition(idx, 1, ptr);
//System.Threading.Thread.Sleep(2000);
//rtn = API.CR_StopAcquisition(idx);
//Marshal.Copy(ptr, buff, 0, buff.Length);
rtn = API.CR_Disconnect(idx); rtn = API.CR_Disconnect(idx);
} }
...@@ -261,15 +289,20 @@ namespace Asa ...@@ -261,15 +289,20 @@ namespace Asa
internal static extern int CR_ResetDetector(int nDetrIndex, bool needReboot); internal static extern int CR_ResetDetector(int nDetrIndex, bool needReboot);
[DllImport("CRInterface.dll")] [DllImport("CRInterface.dll")]
internal static extern int CR_StartAcquisition(int nDetrIndex, int nFrameNum, ref byte[] pBuffer, int nNumFrmReqFromDetr = -1); // nNumFrmReqFromDetr == -1 means that detector sends out frames continuously until StopAcquisition() is received. internal static extern int CR_StartAcquisition(int nDetrIndex, int nFrameNum, [In, Out] byte[] pBuffer, int nNumFrmReqFromDetr = -1); // nNumFrmReqFromDetr == -1 means that detector sends out frames continuously until StopAcquisition() is received.
[DllImport("CRInterface.dll")]
internal static extern int CR_StartAcquisition(int nDetrIndex, int nFrameNum, [In,Out] IntPtr pBuffer, int nNumFrmReqFromDetr = -1); // nNumFrmReqFromDetr == -1 means that detector sends out frames continuously until StopAcquisition() is received.
[DllImport("CRInterface.dll")] [DllImport("CRInterface.dll")]
internal static extern int CR_StopAcquisition(int nDetrIndex); internal static extern int CR_StopAcquisition(int nDetrIndex);
[DllImport("CRCallback.dll")]
internal static extern int CR_RegisterEventCallbackFun(CallbackDelegate pCallback);
[DllImport("CRInterface.dll")] [DllImport("CRInterface.dll")]
internal static extern int CR_RegisterEventCallback(CallbackDelegate pCallback); internal static extern int CR_RegisterEventCallback(CallbackDelegate pCallback);
//internal static extern int CR_RegisterEventCallback(IntPtr pCallback);
[DllImport("CRInterface.dll")] [DllImport("CRInterface.dll")]
internal static extern int CR_SetApplicationMode(int nDetrIndex, int nModeIndex); internal static extern int CR_SetApplicationMode(int nDetrIndex, int nModeIndex);
...@@ -281,33 +314,34 @@ namespace Asa ...@@ -281,33 +314,34 @@ namespace Asa
internal static extern int CR_GetDetectorIndexAndIPAddress(out CR_DetrIdxAndIPAddr pDetrIdxAndIPAddr, out int pDetrNum); internal static extern int CR_GetDetectorIndexAndIPAddress(out CR_DetrIdxAndIPAddr pDetrIdxAndIPAddr, out int pDetrNum);
[DllImport("CRInterface.dll")]
internal static extern int CR_SetApplicationModeWithParam(int nDetrIndex, int nModeIndex, ref float pFrameRate, ref int pExposureTime, int nTriggType, int nGainIndex);
//CARERAY_API_PORT int CR_SetApplicationModeWithParam(int nDetrIndex, int nModeIndex, float* pFrameRate, int* pExposureTime, int nTriggType, int nGainIndex);
//CARERAY_API_PORT int CR_GetDetrStatus(int nDetrIndex, CR_DetrStatus* pDetrStatus); //CARERAY_API_PORT int CR_GetDetrStatus(int nDetrIndex, CR_DetrStatus* pDetrStatus);
//CARERAY_API_PORT int CR_StartDarkCalibration(int nDetrIndex); //CARERAY_API_PORT int CR_StartDarkCalibration(int nDetrIndex);
//CARERAY_API_PORT int CR_StartGainCalibration(int nDetrIndex); //CARERAY_API_PORT int CR_StartGainCalibration(int nDetrIndex);
//CARERAY_API_PORT int CR_StopCalibration(int nDetrIndex); //CARERAY_API_PORT int CR_StopCalibration(int nDetrIndex);
//CARERAY_API_PORT int CR_QueryCalibrationStatus(int nDetrIndex, CR_CalibrationInfo* pCalProgInfo); //CARERAY_API_PORT int CR_QueryCalibrationStatus(int nDetrIndex, CR_CalibrationInfo* pCalProgInfo);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void CallbackDelegate(int nEventID, [In, Out] CR_Event pEvent);
internal delegate void CallbackDelegate([In, Out] int nEventID, [In, Out] CR_Event pEvent);
internal abstract class ICallback internal abstract class ICallback
{ {
internal abstract void Process(int nEventID, IntPtr pEvent); internal abstract void Process(int nEventID, IntPtr pEvent);
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential)]
internal struct CR_Event internal struct CR_Event
{ {
internal int nDetrIndex; internal int nDetrIndex;
internal int nWidth; // Same as CR_ModeInfo.nImageWidth, see A.4 internal int nWidth;
internal int nHeight; // Same as CR_ModeInfo.nImageHeight, see A.4 internal int nHeight;
internal int nPixelDepth; internal int nPixelDepth;
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15925248)] internal int pData;
//internal byte[] pData; // Event-related data
internal IntPtr pData;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
......
...@@ -39,7 +39,7 @@ namespace CarerayImage_Test ...@@ -39,7 +39,7 @@ namespace CarerayImage_Test
//Bitmap bmp = careray.Get16bImage(); //Bitmap bmp = careray.Get16bImage();
bmp.Save(@"C:\Users\neotel\Desktop\20200520X-ray\11.png", System.Drawing.Imaging.ImageFormat.Png); //bmp.Save(@"C:\Users\neotel\Desktop\20200520X-ray\11.png", System.Drawing.Imaging.ImageFormat.Png);
...@@ -60,6 +60,10 @@ namespace CarerayImage_Test ...@@ -60,6 +60,10 @@ namespace CarerayImage_Test
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
careray.GetInfo(); careray.GetInfo();
Bitmap bmp = careray.Get48bImage();
pictureBox1.Image = bmp;
bmp.Save(@"C:\Users\neotel\Desktop\20200520X-ray\22.png", System.Drawing.Imaging.ImageFormat.Png);
} }
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\..\..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
...@@ -42,7 +45,7 @@ ...@@ -42,7 +45,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="X_Ray.cs" /> <Compile Include="CodeFile1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Asa
{
/// <summary>
/// X-ray Source (AVJ Technologies Company)
/// </summary>
public class X_Ray
{
private System.IO.Ports.SerialPort port;
private System.Threading.Thread tWarmUp;
private bool finish;
private string result;
private readonly string LAST_DATE = AppDomain.CurrentDomain.BaseDirectory + "LastUsedDate.txt";
/// <summary>
/// 日志事件委托
/// </summary>
/// <param name="log"></param>
public delegate void LogEvent(string log);
/// <summary>
/// 日志事件
/// </summary>
public LogEvent LogOut;
/// <summary>
/// 预热事件委托
/// </summary>
public delegate void WarmUpCompleteEvent();
/// <summary>
/// 预热事件
/// </summary>
public WarmUpCompleteEvent WarmUpComplete;
/// <summary>
/// X-ray Source
/// </summary>
public X_Ray()
{
port = new System.IO.Ports.SerialPort //9600,N,8,1
{
BaudRate = 9600,
Parity = System.IO.Ports.Parity.None,
DataBits = 8,
StopBits = System.IO.Ports.StopBits.One
};
port.DataReceived += Port_DataReceived;
finish = false;
}
/// <summary>
/// 打开或关闭状态
/// </summary>
public bool IsOpen { get { return port.IsOpen; } }
/// <summary>
/// 打开设备
/// </summary>
/// <param name="portName">串口名称</param>
/// <param name="date">日期</param>
/// <returns></returns>
public bool Open(string portName, string date)
{
port.PortName = portName;
try
{
port.Open();
LogOut?.Invoke("Open " + portName + " OK");
return true;
}
catch (Exception ex)
{
LogOut?.Invoke("Open " + portName + " Error: " + ex.Message);
return false;
}
}
/// <summary>
/// 关闭设备
/// </summary>
/// <param name="date">日期</param>
public void Close(out string date)
{
port.Close();
date = DateTime.Now.ToString();
}
/// <summary>
/// 预热
/// </summary>
public void WarmUp()
{
int days;
DateTime lastUsed;
//距离最后一次使用的天数
if (System.IO.File.Exists(LAST_DATE))
{
string s = System.IO.File.ReadAllText(LAST_DATE);
lastUsed = Convert.ToDateTime(s);
TimeSpan ts = DateTime.Now.Subtract(lastUsed);
days = ts.Days;
}
else
{
lastUsed = DateTime.Now.AddDays(-3);
System.IO.File.WriteAllText(LAST_DATE, lastUsed.ToString());
days = 3;
}
LogOut?.Invoke("距离最后使用的天数:" + days);
tWarmUp = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(WarmUpProcess));
tWarmUp.Start(days);
}
/// <summary>
/// 启动
/// </summary>
/// <param name="voltage">电压</param>
/// <param name="current">电流</param>
public void Start(string voltage, string current)
{
bool rtn = Send("VP" + voltage);
rtn = Send("CP" + current);
}
/// <summary>
/// 停止
/// </summary>
public void Stop()
{
bool rtn = Send("VP0");
rtn = Send("CP0");
}
/// <summary>
/// 预热处理线程
/// </summary>
/// <param name="obj">天数</param>
private void WarmUpProcess(object obj)
{
int days = (int)obj;
int seconds = 0;
bool loop = true;
if (days < 3)
{
LogOut?.Invoke("最后使用天数小于3,不需要预热。");
WarmUpComplete?.Invoke();
return;
}
else if (days >= 3 && days < 30) //3-30天
{
seconds = 30;
}
else if (days >= 30 && days < 90) //1-3月
{
seconds = 60;
}
else if (days >= 90) //3个月以上
{
seconds = 300;
}
int step = 0; //步骤
int sleep = 1; //秒
int timer = 0; //计时器
double[] voltage = new double[10] { 30.00, 35.55, 41.10, 46.65, 52.20, 57.75, 63.30, 68.85, 74.40, 80.00 }; //电压,固定值
double[] current = new double[10] { 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.70 }; //电流,固定值
while (loop)
{
if (timer == 0)
{
Send("VP" + voltage[step]);
Send("CP" + current[step]);
string log = string.Format("预热{0}/10,{1}kV,{2}uA,{3}s", step + 1, voltage[step], current[step], seconds);
LogOut?.Invoke(log);
}
timer += sleep;
if (timer >= seconds)
{
timer = 0;
step++;
if (step == 10)
loop = false;
}
System.Threading.Thread.Sleep(sleep * 1000);
}
//预热完成,最终日期写入
System.IO.File.WriteAllText(LAST_DATE, DateTime.Now.ToString());
LogOut?.Invoke("预热完成。");
WarmUpComplete?.Invoke();
}
private void Port_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
System.Threading.Thread.Sleep(50);
byte[] buffer = new byte[100];
int count = port.Read(buffer, 0, buffer.Length);
if (buffer[0] == 0x02 && buffer[count - 1] == 0x0D)
result = Encoding.ASCII.GetString(buffer, 1, count - 2);
else
result = "";
finish = true;
}
private bool Send(string s)
{
byte[] cmd = Encoding.ASCII.GetBytes(s);
byte[] buff = new byte[cmd.Length + 2];
Array.Copy(cmd, 0, buff, 1, cmd.Length);
buff[0] = 0x02; //包头
buff[buff.Length - 1] = 0x0D; //包尾
try
{
finish = false;
string log = "Send " + s + " Hex: " + HexBuff(buff);
LogOut?.Invoke(log);
port.Write(buff, 0, buff.Length);
bool rtn = Wait();
if (rtn)
LogOut?.Invoke("Received " + result);
else
LogOut?.Invoke("Received Timeout");
return rtn;
}
catch (Exception ex)
{
LogOut?.Invoke("Send " + s + " Error: " + ex.Message);
return false;
}
}
private bool Wait()
{
int time = 0;
while (time < 5000)
{
if (finish) return true;
System.Threading.Thread.Sleep(50);
time += 50;
}
return false;
}
private string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
}
}
...@@ -4,76 +4,79 @@ ...@@ -4,76 +4,79 @@
<name>X-Ray</name> <name>X-Ray</name>
</assembly> </assembly>
<members> <members>
<member name="T:Asa.X_Ray"> <member name="T:Asa.XRay">
<summary> <summary>
X-ray Source (AVJ Technologies Company) X-ray Source (AVJ Technologies Company)
</summary> </summary>
</member> </member>
<member name="T:Asa.X_Ray.LogEvent"> <member name="T:Asa.XRay.WarmUpEvent">
<summary>
日志事件委托
</summary>
<param name="log"></param>
</member>
<member name="F:Asa.X_Ray.LogOut">
<summary>
日志事件
</summary>
</member>
<member name="T:Asa.X_Ray.WarmUpCompleteEvent">
<summary> <summary>
预热事件委托 预热事件委托
</summary> </summary>
<param name="state">预热完成的状态</param>
<param name="text">文本</param>
</member> </member>
<member name="F:Asa.X_Ray.WarmUpComplete"> <member name="E:Asa.XRay.WarmUp">
<summary> <summary>
预热事件 预热事件
</summary> </summary>
</member> </member>
<member name="M:Asa.X_Ray.#ctor"> <member name="M:Asa.XRay.#ctor(System.String)">
<summary> <summary>
X-ray Source X-ray Source
</summary> </summary>
<param name="logName"></param>
</member>
<member name="P:Asa.XRay.IsPortOpen">
<summary>
串口打开或关闭状态
</summary>
</member> </member>
<member name="P:Asa.X_Ray.IsOpen"> <member name="P:Asa.XRay.IsRayOpen">
<summary> <summary>
打开或关闭状态 X射线打开或关闭状态
</summary> </summary>
</member> </member>
<member name="M:Asa.X_Ray.Open(System.String,System.String)"> <member name="M:Asa.XRay.Open(System.String,System.String)">
<summary> <summary>
打开设备 打开设备
</summary> </summary>
<param name="portName">串口名称</param> <param name="portName">串口名称</param>
<param name="date">日期</param> <param name="lastDate">最后使用日期</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Asa.X_Ray.Close(System.String@)"> <member name="M:Asa.XRay.Close">
<summary> <summary>
关闭设备 关闭设备
</summary> </summary>
<param name="date">日期</param>
</member> </member>
<member name="M:Asa.X_Ray.WarmUp"> <member name="M:Asa.XRay.SetVC(System.String,System.String)">
<summary>
设置电压电流
</summary>
<param name="voltage">电压kV(除小数点外必须4位数,不够的补0,小数必须1位)</param>
<param name="current">电流uA(必须4位数,没有小数,不够的补0)</param>
</member>
<member name="M:Asa.XRay.Stop">
<summary> <summary>
预热 停止
</summary> </summary>
<returns></returns>
</member> </member>
<member name="M:Asa.X_Ray.Start(System.String,System.String)"> <member name="M:Asa.XRay.Start">
<summary> <summary>
启动 启动
</summary> </summary>
<param name="voltage">电压</param> <returns></returns>
<param name="current">电流</param>
</member> </member>
<member name="M:Asa.X_Ray.Stop"> <member name="M:Asa.XRay.WatchDog">
<summary> <summary>
停止 看门狗时间,(多线程)
</summary> </summary>
</member> </member>
<member name="M:Asa.X_Ray.WarmUpProcess(System.Object)"> <member name="M:Asa.XRay.WarmUpProcess(System.Object)">
<summary> <summary>
预热处理线程 预热处理,(多线程)
</summary> </summary>
<param name="obj">天数</param> <param name="obj">天数</param>
</member> </member>
......
82156d8f3ba1771f4bbe75311267a8cdcda3e907 36ecf18b599f6835193fbf03760da1eae817e1b9
...@@ -10,3 +10,5 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controll ...@@ -10,3 +10,5 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray Controller.csproj.CoreCompileInputs.cache D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray Controller.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray.dll D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray.pdb D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\bin\Debug\log4net.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray Controller\obj\Debug\X-Ray Controller.csproj.CopyComplete
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<startup> <configSections>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</startup> </configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="XRay" type="log4net.Appender.RollingFileAppender">
<file value="logs/XRay.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<root>
<level value="Debug"/>
<appender-ref ref="XRay"/>
</root>
</log4net>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -33,12 +33,11 @@ ...@@ -33,12 +33,11 @@
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.button5 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBox1 // textBox1
...@@ -47,7 +46,7 @@ ...@@ -47,7 +46,7 @@
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21); this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 0; this.textBox1.TabIndex = 0;
this.textBox1.Text = "COM1"; this.textBox1.Text = "COM6";
// //
// button1 // button1
// //
...@@ -71,17 +70,17 @@ ...@@ -71,17 +70,17 @@
// //
// button3 // button3
// //
this.button3.Location = new System.Drawing.Point(90, 169); this.button3.Location = new System.Drawing.Point(90, 151);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23); this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 3; this.button3.TabIndex = 3;
this.button3.Text = "启动"; this.button3.Text = "设置";
this.button3.UseVisualStyleBackColor = true; this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click); this.button3.Click += new System.EventHandler(this.button3_Click);
// //
// button4 // button4
// //
this.button4.Location = new System.Drawing.Point(171, 169); this.button4.Location = new System.Drawing.Point(171, 253);
this.button4.Name = "button4"; this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23); this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 4; this.button4.TabIndex = 4;
...@@ -89,26 +88,10 @@ ...@@ -89,26 +88,10 @@
this.button4.UseVisualStyleBackColor = true; this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click); this.button4.Click += new System.EventHandler(this.button4_Click);
// //
// numericUpDown1
//
this.numericUpDown1.DecimalPlaces = 2;
this.numericUpDown1.Location = new System.Drawing.Point(90, 115);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(120, 21);
this.numericUpDown1.TabIndex = 5;
//
// numericUpDown2
//
this.numericUpDown2.DecimalPlaces = 2;
this.numericUpDown2.Location = new System.Drawing.Point(90, 142);
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(120, 21);
this.numericUpDown2.TabIndex = 6;
//
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(55, 119); this.label1.Location = new System.Drawing.Point(55, 101);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12); this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 7; this.label1.TabIndex = 7;
...@@ -117,21 +100,48 @@ ...@@ -117,21 +100,48 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(55, 146); this.label2.Location = new System.Drawing.Point(55, 128);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12); this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 8; this.label2.TabIndex = 8;
this.label2.Text = "电流"; this.label2.Text = "电流";
// //
// button5
//
this.button5.Location = new System.Drawing.Point(90, 253);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 9;
this.button5.Text = "开启";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(102, 98);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 10;
this.textBox2.Text = "60.0";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(102, 125);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 21);
this.textBox3.TabIndex = 11;
this.textBox3.Text = "500";
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(378, 288); this.ClientSize = new System.Drawing.Size(378, 288);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button5);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
...@@ -141,8 +151,6 @@ ...@@ -141,8 +151,6 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1"; this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -155,10 +163,11 @@ ...@@ -155,10 +163,11 @@
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
} }
} }
...@@ -12,7 +12,7 @@ namespace X_Ray_Test ...@@ -12,7 +12,7 @@ namespace X_Ray_Test
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
private Asa.X_Ray ray; private Asa.XRay ray;
public Form1() public Form1()
{ {
...@@ -21,27 +21,42 @@ namespace X_Ray_Test ...@@ -21,27 +21,42 @@ namespace X_Ray_Test
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
ray = new Asa.X_Ray(); ray = new Asa.XRay();
ray.WarmUp += Ray_WarmUp;
}
private void Ray_WarmUp(bool state, string text)
{
MessageBox.Show(state.ToString() + "\r\n" + text);
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
ray.Open(textBox1.Text, DateTime.Now.ToString()); bool rtn = ray.Open(textBox1.Text, DateTime.Now.ToString());
MessageBox.Show(rtn.ToString());
} }
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
ray.Close(out string date); ray.Close();
} }
private void button3_Click(object sender, EventArgs e) private void button3_Click(object sender, EventArgs e)
{ {
ray.Start(numericUpDown1.Value.ToString(), numericUpDown2.Value.ToString()); bool rtn = ray.SetVC(textBox2.Text, textBox3.Text);
MessageBox.Show(rtn.ToString());
} }
private void button4_Click(object sender, EventArgs e) private void button4_Click(object sender, EventArgs e)
{ {
ray.Stop(); bool rtn = ray.Stop();
MessageBox.Show(rtn.ToString());
}
private void button5_Click(object sender, EventArgs e)
{
bool rtn = ray.Start();
MessageBox.Show(rtn.ToString());
} }
} }
} }
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using log4net.Config;
namespace X_Ray_Test namespace X_Ray_Test
{ {
...@@ -14,6 +15,7 @@ namespace X_Ray_Test ...@@ -14,6 +15,7 @@ namespace X_Ray_Test
[STAThread] [STAThread]
static void Main() static void Main()
{ {
XmlConfigurator.Configure();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); Application.Run(new Form1());
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
......
...@@ -4,76 +4,79 @@ ...@@ -4,76 +4,79 @@
<name>X-Ray</name> <name>X-Ray</name>
</assembly> </assembly>
<members> <members>
<member name="T:Asa.X_Ray"> <member name="T:Asa.XRay">
<summary> <summary>
X-ray Source (AVJ Technologies Company) X-ray Source (AVJ Technologies Company)
</summary> </summary>
</member> </member>
<member name="T:Asa.X_Ray.LogEvent"> <member name="T:Asa.XRay.WarmUpEvent">
<summary>
日志事件委托
</summary>
<param name="log"></param>
</member>
<member name="F:Asa.X_Ray.LogOut">
<summary>
日志事件
</summary>
</member>
<member name="T:Asa.X_Ray.WarmUpCompleteEvent">
<summary> <summary>
预热事件委托 预热事件委托
</summary> </summary>
<param name="state">预热完成的状态</param>
<param name="text">文本</param>
</member> </member>
<member name="F:Asa.X_Ray.WarmUpComplete"> <member name="E:Asa.XRay.WarmUp">
<summary> <summary>
预热事件 预热事件
</summary> </summary>
</member> </member>
<member name="M:Asa.X_Ray.#ctor"> <member name="M:Asa.XRay.#ctor(System.String)">
<summary> <summary>
X-ray Source X-ray Source
</summary> </summary>
<param name="logName"></param>
</member>
<member name="P:Asa.XRay.IsPortOpen">
<summary>
串口打开或关闭状态
</summary>
</member> </member>
<member name="P:Asa.X_Ray.IsOpen"> <member name="P:Asa.XRay.IsRayOpen">
<summary> <summary>
打开或关闭状态 X射线打开或关闭状态
</summary> </summary>
</member> </member>
<member name="M:Asa.X_Ray.Open(System.String,System.String)"> <member name="M:Asa.XRay.Open(System.String,System.String)">
<summary> <summary>
打开设备 打开设备
</summary> </summary>
<param name="portName">串口名称</param> <param name="portName">串口名称</param>
<param name="date">日期</param> <param name="lastDate">最后使用日期</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Asa.X_Ray.Close(System.String@)"> <member name="M:Asa.XRay.Close">
<summary> <summary>
关闭设备 关闭设备
</summary> </summary>
<param name="date">日期</param>
</member> </member>
<member name="M:Asa.X_Ray.WarmUp"> <member name="M:Asa.XRay.SetVC(System.String,System.String)">
<summary>
设置电压电流
</summary>
<param name="voltage">电压kV(除小数点外必须4位数,不够的补0,小数必须1位)</param>
<param name="current">电流uA(必须4位数,没有小数,不够的补0)</param>
</member>
<member name="M:Asa.XRay.Stop">
<summary> <summary>
预热 停止
</summary> </summary>
<returns></returns>
</member> </member>
<member name="M:Asa.X_Ray.Start(System.String,System.String)"> <member name="M:Asa.XRay.Start">
<summary> <summary>
启动 启动
</summary> </summary>
<param name="voltage">电压</param> <returns></returns>
<param name="current">电流</param>
</member> </member>
<member name="M:Asa.X_Ray.Stop"> <member name="M:Asa.XRay.WatchDog">
<summary> <summary>
停止 看门狗时间,(多线程)
</summary> </summary>
</member> </member>
<member name="M:Asa.X_Ray.WarmUpProcess(System.Object)"> <member name="M:Asa.XRay.WarmUpProcess(System.Object)">
<summary> <summary>
预热处理线程 预热处理,(多线程)
</summary> </summary>
<param name="obj">天数</param> <param name="obj">天数</param>
</member> </member>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<startup> <configSections>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</startup> </configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="XRay" type="log4net.Appender.RollingFileAppender">
<file value="logs/XRay.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<root>
<level value="Debug"/>
<appender-ref ref="XRay"/>
</root>
</log4net>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
9728572b5dc1f8f9a6a4b34e1b551caca05c00bf c6413fc26c632049753ba8163af85e10a65b8698
...@@ -12,3 +12,4 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controll ...@@ -12,3 +12,4 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\obj\Debug\X-Ray_Test.csproj.CopyComplete D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\obj\Debug\X-Ray_Test.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\obj\Debug\X-Ray_Test.exe D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\obj\Debug\X-Ray_Test.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\obj\Debug\X-Ray_Test.pdb D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\obj\Debug\X-Ray_Test.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AutoCountMachine\X-Ray Controller\X-Ray_Test\bin\Debug\log4net.dll
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!