Commit 4fe3a74d 刘韬

1

1 个父辈 7be387a5
......@@ -41,6 +41,7 @@ namespace ScanCodeServer
this.textBox_addr = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btn_test = new System.Windows.Forms.Button();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.SuspendLayout();
......@@ -143,11 +144,22 @@ namespace ScanCodeServer
this.button1.UseVisualStyleBackColor = true;
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
//
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.btn_test);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox_addr);
this.Controls.Add(this.label3);
......@@ -176,6 +188,7 @@ namespace ScanCodeServer
private System.Windows.Forms.TextBox textBox_addr;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btn_test;
}
}
using ConfigHelper;
using HalconDotNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -106,7 +107,7 @@ namespace ScanCodeServer
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
ConfigHelper.Config.Set<int>("MaxMenory", (int)numericUpDown1.Value);
ConfigHelper.Config.SaveChange();
//ConfigHelper.Config.SaveChange();
Monitor.MaxMenory = (int)numericUpDown1.Value;
}
......@@ -121,7 +122,7 @@ namespace ScanCodeServer
{
var u = new Uri(textBox_addr.Text);
Config.Set("Addr", u.ToString());
Config.SaveChange();
//Config.SaveChange();
WebServer.Close();
server = textBox_addr.Text;
WebServer.Open(server);
......@@ -130,5 +131,18 @@ namespace ScanCodeServer
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);
}
}
}
......@@ -29,5 +29,11 @@ namespace ScanCodeServer
OverTimes?.Invoke(null, EventArgs.Empty);
}
}
static public void FireExit(string msg)
{
Common.log.Info(msg);
overtimes = true;
OverTimes?.Invoke(null, EventArgs.Empty);
}
}
}
......@@ -14,7 +14,7 @@
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
......@@ -26,13 +26,14 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
......@@ -106,4 +107,7 @@
<None Include="App.config" />
</ItemGroup>
<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>
\ No newline at end of file
......@@ -33,7 +33,10 @@ namespace ScanCodeServer
{
BinaryFormatter bf = new BinaryFormatter();
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();
return Process(ho_Image, bitmap, GetRemoteDecodeParam(param));
}
......@@ -43,7 +46,7 @@ namespace ScanCodeServer
return Process(ho_Image,null, GetRemoteDecodeParam(param));
}
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;
int codeCount = remoteDecodeParam.codeCount;
......@@ -123,7 +126,7 @@ namespace ScanCodeServer
}
}
RemoteDecodeParam GetRemoteDecodeParam(string param) {
internal RemoteDecodeParam GetRemoteDecodeParam(string param) {
param = param.Replace('-', '+').Replace('_', '/');
var stream = Convert.FromBase64String(param);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!