HGScannerLib添加C# demo

This commit is contained in:
luoliangyi 2022-10-12 09:27:43 +08:00
parent a9d019a1a6
commit 97d20e734b
12 changed files with 999 additions and 0 deletions

View File

@ -0,0 +1,62 @@

namespace WindowsFormsApp1
{
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.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(301, 157);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(166, 65);
this.button1.TabIndex = 0;
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.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
}

View File

@ -0,0 +1,281 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Globalization;
using System.Timers;
using System.Threading;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
UIntPtr image = HGScannerLib.HGLib_LoadImage(StringToUtf8("1.jpg"));
if (UIntPtr.Zero != image)
{
HGScannerLib.HGLibSaveImageParam saveParam;
saveParam.size = 20;
saveParam.jpegQuality = 80;
saveParam.tiffCompression = 4;
saveParam.tiffJpegQuality = 80;
saveParam.ocr = 0;
HGScannerLib.HGLib_SaveImage(image, StringToUtf8("2.jpg"), ref saveParam);
HGScannerLib.HGLib_ReleaseImage(image);
}
HGScannerLib.HGLibDeviceHotPlugEventFunc fun = new HGScannerLib.HGLibDeviceHotPlugEventFunc(DeviceHotPlugEventFunc);
HGScannerLib.HGLib_InitDevice(fun, this.Handle);
Thread.Sleep(500);
IntPtr deviceNameList = HGScannerLib.HGLib_GetDeviceNameList();
if (IntPtr.Zero != deviceNameList)
{
// 获取设备列表
int i = 0;
IntPtr deviceName = Marshal.ReadIntPtr(deviceNameList, 0);
while (IntPtr.Zero != deviceName)
{
String deviceNameText = Utf8ToString(deviceName);
++i;
deviceName = Marshal.ReadIntPtr(deviceNameList, Marshal.SizeOf(typeof(IntPtr)) * i);
}
// 打开第一个设备
UIntPtr device = HGScannerLib.HGLib_OpenDevice(Marshal.ReadIntPtr(deviceNameList, 0));
if (UIntPtr.Zero != device)
{
// 获取序列号
Byte[] sn = new Byte[60];
IntPtr snAddr = Marshal.UnsafeAddrOfPinnedArrayElement(sn, 0);
HGScannerLib.HGLib_GetDeviceSN(device, snAddr, 60);
String snText = Utf8ToString(snAddr);
// 获取固件版本号
Byte[] fwVer = new Byte[60];
IntPtr fwVerAddr = Marshal.UnsafeAddrOfPinnedArrayElement(fwVer, 0);
HGScannerLib.HGLib_GetDeviceFWVersion(device, fwVerAddr, 60);
String fwVerText = Utf8ToString(fwVerAddr);
// 设置待纸扫描
Int32[] dzsm = new Int32[1];
dzsm[0] = 1;
Int32 ret1 = HGScannerLib.HGLib_SetDeviceParam(device, 67,
Marshal.UnsafeAddrOfPinnedArrayElement(dzsm, 0));
// 设置旋转90度
UInt32[] rotate = new UInt32[1];
rotate[0] = 67;
Int32 ret2 = HGScannerLib.HGLib_SetDeviceParam(device, 59,
Marshal.UnsafeAddrOfPinnedArrayElement(rotate, 0));
// 设置伽马值
Double[] gamma = new Double[1];
gamma[0] = 1.0;
Int32 ret3 = HGScannerLib.HGLib_SetDeviceParam(device, 35,
Marshal.UnsafeAddrOfPinnedArrayElement(gamma, 0));
// 获取旋转的配置
IntPtr rotateParam = HGScannerLib.HGLib_GetDeviceParam(device, 59);
if (IntPtr.Zero != rotateParam)
{
HGScannerLib.HGLibDeviceParam param = (HGScannerLib.HGLibDeviceParam)
Marshal.PtrToStructure(rotateParam, typeof(HGScannerLib.HGLibDeviceParam));
// print param
PrintParam(ref param);
HGScannerLib.HGLib_ReleaseDeviceParam(rotateParam);
}
// 获取所有配置
UInt32 groupCount = 0;
IntPtr groupParamList = HGScannerLib.HGLib_GetDeviceParamGroupList(device, ref groupCount);
if (IntPtr.Zero != groupParamList)
{
for (int groupIdx = 0; groupIdx < (int)groupCount; ++groupIdx)
{
HGScannerLib.HGLibDeviceParamGroup group = (HGScannerLib.HGLibDeviceParamGroup)
Marshal.PtrToStructure(groupParamList + Marshal.SizeOf(typeof(HGScannerLib.HGLibDeviceParamGroup)) * groupIdx,
typeof(HGScannerLib.HGLibDeviceParamGroup));
// 组名
UInt32 groupName = group.group;
// 组内配置的数量
UInt32 paramCount = group.paramCount;
for (int paramIdx = 0; paramIdx < group.paramCount; ++paramIdx)
{
HGScannerLib.HGLibDeviceParam param = (HGScannerLib.HGLibDeviceParam)
Marshal.PtrToStructure(group.param + Marshal.SizeOf(typeof(HGScannerLib.HGLibDeviceParam)) * paramIdx,
typeof(HGScannerLib.HGLibDeviceParam));
// print param
PrintParam(ref param);
}
}
HGScannerLib.HGLib_ReleaseDeviceParamGroupList(groupParamList, groupCount);
}
// 扫描
m_break = false;
HGScannerLib.HGLibDeviceScanEventFunc eventFunc = new HGScannerLib.HGLibDeviceScanEventFunc(DeviceScanEventFunc);
HGScannerLib.HGLibDeviceScanImageFunc imageFunc = new HGScannerLib.HGLibDeviceScanImageFunc(DeviceScanImageFunc);
Int32 scanRet = HGScannerLib.HGLib_StartDeviceScan(device, eventFunc, this.Handle, imageFunc, this.Handle);
if (0 != scanRet)
{
while (!m_break)
{
Thread.Sleep(100);
}
HGScannerLib.HGLib_StopDeviceScan(device);
}
HGScannerLib.HGLib_CloseDevice(device);
}
HGScannerLib.HGLib_ReleaseDeviceNameList(deviceNameList);
}
HGScannerLib.HGLib_DeinitDevice();
}
public void DeviceHotPlugEventFunc(UInt32 evt, IntPtr deviceName, IntPtr param)
{
String devNameText = Utf8ToString(deviceName);
}
public void DeviceScanEventFunc(UIntPtr device, UInt32 evt, Int32 err, IntPtr info, IntPtr param)
{
if (evt == 2)
{
m_break = true;
}
else if (3 == evt)
{
String infoText = Utf8ToString(info);
}
}
public void DeviceScanImageFunc(UIntPtr device, UIntPtr image, IntPtr param)
{
String fileName = String.Format("Scan_{0}.jpg", m_scanCount);
++m_scanCount;
HGScannerLib.HGLibSaveImageParam saveParam;
saveParam.size = 20;
saveParam.jpegQuality = 80;
saveParam.tiffCompression = 4;
saveParam.tiffJpegQuality = 80;
saveParam.ocr = 0;
HGScannerLib.HGLib_SaveImage(image, StringToUtf8(fileName), ref saveParam);
}
public String Utf8ToString(IntPtr str)
{
if (IntPtr.Zero == str)
{
return "";
}
int len = 0;
while (0 != Marshal.ReadByte(str, len))
{
++len;
}
if (0 == len)
{
return "";
}
Byte[] utf8 = new Byte[len];
Marshal.Copy(str, utf8, 0, len);
return Encoding.UTF8.GetString(utf8);
}
public IntPtr StringToUtf8(String str)
{
if (str.Length == 0)
{
return IntPtr.Zero;
}
Byte[] src = Encoding.UTF8.GetBytes(str);
Byte[] dst = new Byte[src.Length + 1];
for (int i = 0; i < src.Length; ++i)
dst[i] = src[i];
dst[dst.Length - 1] = 0;
return Marshal.UnsafeAddrOfPinnedArrayElement(dst, 0);
}
public void PrintParam(ref HGScannerLib.HGLibDeviceParam param)
{
// 配置名
UInt32 option = param.option;
if (1 == param.type) // 整型
{
Int32 value = param.typeValue.intValue;
}
else if (2 == param.type) // 枚举
{
UInt32 value = param.typeValue.enumValue;
}
else if (3 == param.type) // 双精度浮点
{
Double value = param.typeValue.doubleValue;
}
else if (4 == param.type) // BOOL
{
Int32 value = param.typeValue.boolValue;
}
if (param.rangeType == 1) // 整型列表
{
Int32[] intValueList = new Int32[param.rangeTypeValue.intValueList.count];
Marshal.Copy(param.rangeTypeValue.intValueList.value, intValueList, 0, (int)param.rangeTypeValue.intValueList.count);
}
else if (param.rangeType == 2) // 枚举列表
{
Int32[] enumValueList = new Int32[param.rangeTypeValue.enumValueList.count];
Marshal.Copy(param.rangeTypeValue.enumValueList.value, enumValueList, 0, (int)param.rangeTypeValue.enumValueList.count);
}
else if (param.rangeType == 3) // 双精度浮点列表
{
Double[] doubleValueList = new Double[param.rangeTypeValue.doubleValueList.count];
Marshal.Copy(param.rangeTypeValue.doubleValueList.value, doubleValueList, 0, (int)param.rangeTypeValue.doubleValueList.count);
}
else if (param.rangeType == 4) // 整型范围
{
// 最小值
Int32 minVal = param.rangeTypeValue.intValueRange.minValue;
// 最大值
Int32 maxVal = param.rangeTypeValue.intValueRange.maxValue;
}
else if (param.rangeType == 5) // 双精度浮点范围
{
// 最小值
Double minVal = param.rangeTypeValue.doubleValueRange.minValue;
// 最大值
Double maxVal = param.rangeTypeValue.doubleValueRange.maxValue;
}
}
public UInt32 m_scanCount = 1;
public Boolean m_break = false;
}
}

View File

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

View File

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WindowsFormsApp1
{
public class HGScannerLib
{
public struct HGLibSaveImageParam
{
public UInt32 size;
public UInt32 jpegQuality;
public UInt32 tiffCompression;
public UInt32 tiffJpegQuality;
public Int32 ocr;
}
public struct HGLibDeviceIntValueList
{
public IntPtr value; // Int32指针
public UInt32 count;
}
public struct HGLibDeviceEnumValueList
{
public IntPtr value; // UInt32指针
public UInt32 count;
}
public struct HGLibDeviceDoubleValueList
{
public IntPtr value; // Double指针
public UInt32 count;
}
public struct HGLibDeviceIntValueRange
{
public Int32 minValue;
public Int32 maxValue;
}
public struct HGLibDeviceDoubleValueRange
{
public Double minValue;
public Double maxValue;
}
[StructLayout(LayoutKind.Explicit)]
public struct HGLibDeviceParamType
{
[FieldOffset(0)] public Int32 intValue;
[FieldOffset(0)] public UInt32 enumValue;
[FieldOffset(0)] public Double doubleValue;
[FieldOffset(0)] public Int32 boolValue;
}
[StructLayout(LayoutKind.Explicit)]
public struct HGLibDeviceParamRangeType
{
[FieldOffset(0)] public HGLibDeviceIntValueList intValueList;
[FieldOffset(0)] public HGLibDeviceEnumValueList enumValueList;
[FieldOffset(0)] public HGLibDeviceDoubleValueList doubleValueList;
[FieldOffset(0)] public HGLibDeviceIntValueRange intValueRange;
[FieldOffset(0)] public HGLibDeviceDoubleValueRange doubleValueRange;
}
public struct HGLibDeviceParam
{
public UInt32 option;
public UInt32 type;
public HGLibDeviceParamType typeValue;
public UInt32 rangeType;
public HGLibDeviceParamRangeType rangeTypeValue;
}
public struct HGLibDeviceParamGroup
{
public UInt32 group;
public IntPtr param; // HGLibDeviceParam指针
public UInt32 paramCount;
}
public delegate void HGLibDeviceHotPlugEventFunc(UInt32 evt, IntPtr deviceName, IntPtr param);
public delegate void HGLibDeviceScanEventFunc(UIntPtr device, UInt32 evt, Int32 err, IntPtr info, IntPtr param);
public delegate void HGLibDeviceScanImageFunc(UIntPtr device, UIntPtr image, IntPtr param);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_LoadImage")]
public static extern UIntPtr HGLib_LoadImage(IntPtr filePath);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_SaveImage")]
public static extern Int32 HGLib_SaveImage(UIntPtr image, IntPtr filePath, ref HGLibSaveImageParam saveParam);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_ReleaseImage")]
public static extern Int32 HGLib_ReleaseImage(UIntPtr image);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_InitDevice")]
public static extern Int32 HGLib_InitDevice(HGLibDeviceHotPlugEventFunc func, IntPtr param);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_DeinitDevice")]
public static extern Int32 HGLib_DeinitDevice();
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_GetDeviceNameList")]
public static extern IntPtr HGLib_GetDeviceNameList();
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_ReleaseDeviceNameList")]
public static extern Int32 HGLib_ReleaseDeviceNameList(IntPtr deviceNameList);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_OpenDevice")]
public static extern UIntPtr HGLib_OpenDevice(IntPtr deviceName);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_CloseDevice")]
public static extern Int32 HGLib_CloseDevice(UIntPtr device);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_GetDeviceSN")]
public static extern Int32 HGLib_GetDeviceSN(UIntPtr device, IntPtr sn, UInt32 maxLen);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_GetDeviceFWVersion")]
public static extern Int32 HGLib_GetDeviceFWVersion(UIntPtr device, IntPtr fwVersion, UInt32 maxLen);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_SetDeviceParam")]
public static extern Int32 HGLib_SetDeviceParam(UIntPtr device, UInt32 option, IntPtr data);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_GetDeviceParamGroupList")]
public static extern IntPtr HGLib_GetDeviceParamGroupList(UIntPtr device, ref UInt32 count);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_GetDeviceParam")]
public static extern IntPtr HGLib_GetDeviceParam(UIntPtr device, UInt32 option);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_ReleaseDeviceParamGroupList")]
public static extern Int32 HGLib_ReleaseDeviceParamGroupList(IntPtr devParamGroup, UInt32 count);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_ReleaseDeviceParam")]
public static extern Int32 HGLib_ReleaseDeviceParam(IntPtr devParam);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_ResetDeviceParam")]
public static extern Int32 HGLib_ResetDeviceParam(UIntPtr device);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_DeviceIsPaperOn")]
public static extern Int32 HGLib_DeviceIsPaperOn(UIntPtr device);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_StartDeviceScan")]
public static extern Int32 HGLib_StartDeviceScan(UIntPtr device, HGLibDeviceScanEventFunc eventFunc, IntPtr eventParam,
HGLibDeviceScanImageFunc imageFunc, IntPtr imageParam);
[DllImport("HGScannerLib.dll", EntryPoint = "HGLib_StopDeviceScan")]
public static extern Int32 HGLib_StopDeviceScan(UIntPtr device);
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WindowsFormsApp1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsFormsApp1")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("e364d770-bb5c-400a-902e-213a3dadcbd5")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp1.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("WindowsFormsApp1.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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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>

View File

@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <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 WindowsFormsApp1.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;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?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>

View File

@ -0,0 +1,81 @@
<?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>{E364D770-BB5C-400A-902E-213A3DADCBD5}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WindowsFormsApp1</RootNamespace>
<AssemblyName>WindowsFormsApp1</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</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.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="HGScannerLib.cs" />
<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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32228.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1", "WindowsFormsApp1.csproj", "{E364D770-BB5C-400A-902E-213A3DADCBD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E364D770-BB5C-400A-902E-213A3DADCBD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E364D770-BB5C-400A-902E-213A3DADCBD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E364D770-BB5C-400A-902E-213A3DADCBD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E364D770-BB5C-400A-902E-213A3DADCBD5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8B1D5CE6-959A-4477-B3BE-E7DEDDE78BB6}
EndGlobalSection
EndGlobal