Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HalconScanCodeServer
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4fe3a74d
由
刘韬
编写于
2022-05-30 10:06:41 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
7be387a5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
47 行增加
和
7 行删除
ScanCodeServer/Form1.Designer.cs
ScanCodeServer/Form1.cs
ScanCodeServer/Monitor.cs
ScanCodeServer/ScanCodeServer.csproj
ScanCodeServer/WebWork.cs
ScanCodeServer/Form1.Designer.cs
查看文件 @
4fe3a74
...
@@ -41,6 +41,7 @@ namespace ScanCodeServer
...
@@ -41,6 +41,7 @@ namespace ScanCodeServer
this
.
textBox_addr
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
textBox_addr
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_test
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
contextMenuStrip1
.
SuspendLayout
();
this
.
contextMenuStrip1
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numericUpDown1
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numericUpDown1
)).
BeginInit
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
...
@@ -143,11 +144,22 @@ namespace ScanCodeServer
...
@@ -143,11 +144,22 @@ namespace ScanCodeServer
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
//
// btn_test
//
this
.
btn_test
.
Location
=
new
System
.
Drawing
.
Point
(
635
,
386
);
this
.
btn_test
.
Name
=
"btn_test"
;
this
.
btn_test
.
Size
=
new
System
.
Drawing
.
Size
(
102
,
23
);
this
.
btn_test
.
TabIndex
=
5
;
this
.
btn_test
.
Text
=
"test"
;
this
.
btn_test
.
UseVisualStyleBackColor
=
true
;
this
.
btn_test
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_test_Click
);
//
// 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
(
800
,
450
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
800
,
450
);
this
.
Controls
.
Add
(
this
.
btn_test
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
textBox_addr
);
this
.
Controls
.
Add
(
this
.
textBox_addr
);
this
.
Controls
.
Add
(
this
.
label3
);
this
.
Controls
.
Add
(
this
.
label3
);
...
@@ -176,6 +188,7 @@ namespace ScanCodeServer
...
@@ -176,6 +188,7 @@ namespace ScanCodeServer
private
System
.
Windows
.
Forms
.
TextBox
textBox_addr
;
private
System
.
Windows
.
Forms
.
TextBox
textBox_addr
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
Button
btn_test
;
}
}
}
}
ScanCodeServer/Form1.cs
查看文件 @
4fe3a74
using
ConfigHelper
;
using
ConfigHelper
;
using
HalconDotNet
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.ComponentModel
;
...
@@ -106,7 +107,7 @@ namespace ScanCodeServer
...
@@ -106,7 +107,7 @@ namespace ScanCodeServer
private
void
numericUpDown1_ValueChanged
(
object
sender
,
EventArgs
e
)
private
void
numericUpDown1_ValueChanged
(
object
sender
,
EventArgs
e
)
{
{
ConfigHelper
.
Config
.
Set
<
int
>(
"MaxMenory"
,
(
int
)
numericUpDown1
.
Value
);
ConfigHelper
.
Config
.
Set
<
int
>(
"MaxMenory"
,
(
int
)
numericUpDown1
.
Value
);
ConfigHelper
.
Config
.
SaveChange
();
//
ConfigHelper.Config.SaveChange();
Monitor
.
MaxMenory
=
(
int
)
numericUpDown1
.
Value
;
Monitor
.
MaxMenory
=
(
int
)
numericUpDown1
.
Value
;
}
}
...
@@ -121,7 +122,7 @@ namespace ScanCodeServer
...
@@ -121,7 +122,7 @@ namespace ScanCodeServer
{
{
var
u
=
new
Uri
(
textBox_addr
.
Text
);
var
u
=
new
Uri
(
textBox_addr
.
Text
);
Config
.
Set
(
"Addr"
,
u
.
ToString
());
Config
.
Set
(
"Addr"
,
u
.
ToString
());
Config
.
SaveChange
();
//
Config.SaveChange();
WebServer
.
Close
();
WebServer
.
Close
();
server
=
textBox_addr
.
Text
;
server
=
textBox_addr
.
Text
;
WebServer
.
Open
(
server
);
WebServer
.
Open
(
server
);
...
@@ -130,5 +131,18 @@ namespace ScanCodeServer
...
@@ -130,5 +131,18 @@ namespace ScanCodeServer
MessageBox
.
Show
(
"输入的格式不正确"
);
MessageBox
.
Show
(
"输入的格式不正确"
);
}
}
}
}
private
void
btn_test_Click
(
object
sender
,
EventArgs
e
)
{
Bitmap
bitmap
=
new
Bitmap
(
"test.bmp"
);
WebWork
webWork
=
new
WebWork
();
HDCodeHelper
.
Bitmap2HObjectBpp24
(
bitmap
,
out
HObject
ho_Image
);
//bitmap.Dispose();
RemoteDecodeParam
remoteDecodeParam
=
new
RemoteDecodeParam
();
remoteDecodeParam
.
codeTypeList
=
new
string
[]
{
"barcode"
,
"Data Matrix ECC 200"
,
"QR Code"
,
"PDF417"
,
"eyem"
};
remoteDecodeParam
.
codeCount
=
3
;
remoteDecodeParam
.
timeout
=
3000
;
webWork
.
Process
(
ho_Image
,
bitmap
,
remoteDecodeParam
);
}
}
}
}
}
ScanCodeServer/Monitor.cs
查看文件 @
4fe3a74
...
@@ -29,5 +29,11 @@ namespace ScanCodeServer
...
@@ -29,5 +29,11 @@ namespace ScanCodeServer
OverTimes
?.
Invoke
(
null
,
EventArgs
.
Empty
);
OverTimes
?.
Invoke
(
null
,
EventArgs
.
Empty
);
}
}
}
}
static
public
void
FireExit
(
string
msg
)
{
Common
.
log
.
Info
(
msg
);
overtimes
=
true
;
OverTimes
?.
Invoke
(
null
,
EventArgs
.
Empty
);
}
}
}
}
}
ScanCodeServer/ScanCodeServer.csproj
查看文件 @
4fe3a74
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<Deterministic>true</Deterministic>
<Deterministic>true</Deterministic>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
x64
</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>false</Optimize>
...
@@ -26,13 +26,14 @@
...
@@ -26,13 +26,14 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
x64
</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationManifest>app.manifest</ApplicationManifest>
...
@@ -106,4 +107,7 @@
...
@@ -106,4 +107,7 @@
<None Include="App.config" />
<None Include="App.config" />
</ItemGroup>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x86\editbin" /largeaddressaware "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
\ No newline at end of file
\ No newline at end of file
ScanCodeServer/WebWork.cs
查看文件 @
4fe3a74
...
@@ -33,7 +33,10 @@ namespace ScanCodeServer
...
@@ -33,7 +33,10 @@ namespace ScanCodeServer
{
{
BinaryFormatter
bf
=
new
BinaryFormatter
();
BinaryFormatter
bf
=
new
BinaryFormatter
();
Bitmap
bitmap
=
(
Bitmap
)
bf
.
Deserialize
(
info
);
Bitmap
bitmap
=
(
Bitmap
)
bf
.
Deserialize
(
info
);
HDCodeHelper
.
Bitmap2HObjectBpp24
(
bitmap
,
out
HObject
ho_Image
);
if
(!
HDCodeHelper
.
Bitmap2HObjectBpp24
(
bitmap
,
out
HObject
ho_Image
))
{
Monitor
.
FireExit
(
"bitmap转hoimage失败,可能内存不足"
);
}
//bitmap.Dispose();
//bitmap.Dispose();
return
Process
(
ho_Image
,
bitmap
,
GetRemoteDecodeParam
(
param
));
return
Process
(
ho_Image
,
bitmap
,
GetRemoteDecodeParam
(
param
));
}
}
...
@@ -43,7 +46,7 @@ namespace ScanCodeServer
...
@@ -43,7 +46,7 @@ namespace ScanCodeServer
return
Process
(
ho_Image
,
null
,
GetRemoteDecodeParam
(
param
));
return
Process
(
ho_Image
,
null
,
GetRemoteDecodeParam
(
param
));
}
}
object
o
=
new
object
();
object
o
=
new
object
();
string
Process
(
HObject
ho_Image
,
Bitmap
bitmap
,
RemoteDecodeParam
remoteDecodeParam
)
internal
string
Process
(
HObject
ho_Image
,
Bitmap
bitmap
,
RemoteDecodeParam
remoteDecodeParam
)
{
{
string
[]
codeTypeList
=
remoteDecodeParam
.
codeTypeList
;
string
[]
codeTypeList
=
remoteDecodeParam
.
codeTypeList
;
int
codeCount
=
remoteDecodeParam
.
codeCount
;
int
codeCount
=
remoteDecodeParam
.
codeCount
;
...
@@ -123,7 +126,7 @@ namespace ScanCodeServer
...
@@ -123,7 +126,7 @@ namespace ScanCodeServer
}
}
}
}
RemoteDecodeParam
GetRemoteDecodeParam
(
string
param
)
{
internal
RemoteDecodeParam
GetRemoteDecodeParam
(
string
param
)
{
param
=
param
.
Replace
(
'-'
,
'+'
).
Replace
(
'_'
,
'/'
);
param
=
param
.
Replace
(
'-'
,
'+'
).
Replace
(
'_'
,
'/'
);
var
stream
=
Convert
.
FromBase64String
(
param
);
var
stream
=
Convert
.
FromBase64String
(
param
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论