测试程序更改

DS7_JinGang
ddlucky 2 years ago
parent 16fb1ff074
commit 094120a9f5

@ -35,6 +35,8 @@
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
@ -103,11 +105,31 @@
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(249, 174);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(106, 23);
this.button6.TabIndex = 8;
this.button6.Text = "消息队列发送";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(12, 176);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(231, 21);
this.textBox2.TabIndex = 9;
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(294, 181);
this.ClientSize = new System.Drawing.Size(704, 585);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
@ -131,6 +153,8 @@
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.TextBox textBox2;
}
}

@ -24,6 +24,9 @@ using System.Windows.Forms;
using static System.Net.Mime.MediaTypeNames;
using Rectangle = System.Drawing.Rectangle;
//using D7MqClient;
using Topshelf;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace TestForm
@ -424,6 +427,45 @@ namespace TestForm
//Console.ReadKey();
}
private IConnection mqConn;
private void button6_Click(object sender, EventArgs e)
{
textBox2.Text= SetLength(textBox2.Text, 20);
}
public static string SetLength(string oldstr, int length)
{
var str = string.IsNullOrWhiteSpace(oldstr) ? "" : (len(oldstr) > length) ? SubString2(oldstr, 0, length) : oldstr;
return str;
}
public static int len(string str)
{
System.Text.ASCIIEncoding n = new System.Text.ASCIIEncoding();
byte[] b = n.GetBytes(str);
int length = 0; // l 为字符串的实际长度
for (int i = 0; i <= b.Length - 1; i++)
{
if (b[i] == 63) //判断是否为汉字或全脚符号
{
length++;
}
length++;
}
return length;
}
public static string SubString2(string str, int startIndex, int length)
{
byte[] b = System.Text.Encoding.Default.GetBytes(str);
return System.Text.Encoding.Default.GetString(b, startIndex, length);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
}
class Test

@ -87,11 +87,15 @@
<Reference Include="Quartz, Version=2.6.2.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Quartz.2.6.2\lib\net40\Quartz.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.Client">
<HintPath>..\..\..\packages\RabbitMQ.Client.6.2.2\lib\net461\RabbitMQ.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
@ -103,6 +107,12 @@
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -112,6 +122,9 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Topshelf, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Topshelf.4.3.0\lib\net452\Topshelf.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>

@ -19,4 +19,6 @@
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="Topshelf" version="4.3.0" targetFramework="net472" />
</packages>
Loading…
Cancel
Save