Skip to content

Commit bfa28f2

Browse files
committed
让测试工具支持AOT中。。。
1 parent c24933d commit bfa28f2

22 files changed

+827
-190
lines changed

QpTestClient/ConnectForm.Designer.cs

Lines changed: 82 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QpTestClient/ConnectForm.cs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
using System.Text.Json;
22
using Quick.Protocol;
3-
using Quick.Protocol.Utils;
4-
using Quick.Xml;
53
using System;
6-
using System.Collections.Generic;
74
using System.ComponentModel;
8-
using System.Data;
95
using System.Drawing;
10-
using System.IO;
116
using System.Linq;
12-
using System.Reflection;
137
using System.Text;
148
using System.Threading.Tasks;
159
using System.Windows.Forms;
16-
using QpTestClient.Utils;
1710

1811
namespace QpTestClient
1912
{
2013
public partial class ConnectForm : Form
2114
{
2215
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
2316
public TestConnectionInfo ConnectionInfo { get; private set; }
24-
17+
private QpClientOptions clientOptions = null;
2518
public ConnectForm()
2619
{
2720
InitializeComponent();
@@ -33,7 +26,7 @@ public ConnectForm()
3326

3427
public void EditConnectionInfo(TestConnectionInfo connectionInfo)
3528
{
36-
this.ConnectionInfo = XmlConvert.Deserialize<TestConnectionInfo>(XmlConvert.Serialize(connectionInfo), QpdFileUtils.XmlConvertOptions);
29+
this.ConnectionInfo = connectionInfo;
3730
txtName.Text = connectionInfo.Name;
3831
var qpClientTypeInfo = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.ClientType.FullName == connectionInfo.QpClientTypeName);
3932
cbConnectType.SelectedItem = qpClientTypeInfo;
@@ -47,32 +40,31 @@ private void ConnectForm_Load(object sender, EventArgs e)
4740

4841
if (cbConnectType.Items.Count <= 0)
4942
return;
50-
var qpClientTypeName = "Quick.Protocol.Tcp.QpTcpClient";
43+
5144
if (ConnectionInfo != null)
52-
qpClientTypeName = ConnectionInfo.QpClientTypeName;
53-
var item = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.ClientType.FullName == qpClientTypeName);
54-
if (item != null)
45+
{
46+
var qpClientTypeName = ConnectionInfo.QpClientTypeName;
47+
var item = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.ClientType.FullName == qpClientTypeName);
5548
cbConnectType.SelectedItem = item;
56-
else
57-
cbConnectType.SelectedIndex = 0;
49+
}
5850
}
5951

6052
private void cbConnectType_SelectedIndexChanged(object sender, EventArgs e)
6153
{
6254
var qpClientTypeInfo = (QpClientTypeInfo)cbConnectType.SelectedItem;
63-
64-
QpClientOptions options = null;
6555
if (ConnectionInfo != null && qpClientTypeInfo.ClientType.FullName == ConnectionInfo.QpClientTypeName)
6656
{
67-
options = (QpClientOptions)JsonSerializer.Deserialize(
68-
JsonSerializer.Serialize(ConnectionInfo.QpClientOptions),
69-
qpClientTypeInfo.OptionsType);
57+
clientOptions = ConnectionInfo.QpClientOptions.Clone();
7058
}
7159
else
7260
{
73-
options = qpClientTypeInfo.CreateOptionsInstanceFunc();
61+
clientOptions = qpClientTypeInfo.CreateOptionsInstanceFunc();
7462
}
75-
pgOptions.SelectedObject = options;
63+
pnlClientOptions.Controls.Clear();
64+
var control = qpClientTypeInfo.CreateOptionsControlFunc();
65+
control.DataContext = clientOptions;
66+
control.Dock = DockStyle.Fill;
67+
pnlClientOptions.Controls.Add(control);
7668
}
7769

7870
private void btnOk_Click(object sender, EventArgs e)
@@ -89,7 +81,7 @@ private void btnOk_Click(object sender, EventArgs e)
8981
{
9082
Name = name,
9183
QpClientTypeName = qpClientTypeInfo.ClientType.FullName,
92-
QpClientOptions = (QpClientOptions)pgOptions.SelectedObject,
84+
QpClientOptions = clientOptions,
9385
Instructions = ConnectionInfo?.Instructions
9486
};
9587
DialogResult = DialogResult.OK;

QpTestClient/ConnectForm.resx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<root>
3-
<!--
4-
Microsoft ResX Schema
5-
3+
<!--
4+
Microsoft ResX Schema
5+
66
Version 2.0
7-
8-
The primary goals of this format is to allow a simple XML format
9-
that is mostly human readable. The generation and parsing of the
10-
various data types are done through the TypeConverter classes
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
1111
associated with the data types.
12-
12+
1313
Example:
14-
14+
1515
... ado.net/XML headers & schema ...
1616
<resheader name="resmimetype">text/microsoft-resx</resheader>
1717
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
2626
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
2727
<comment>This is a comment</comment>
2828
</data>
29-
30-
There are any number of "resheader" rows that contain simple
29+
30+
There are any number of "resheader" rows that contain simple
3131
name/value pairs.
32-
33-
Each data row contains a name, and value. The row also contains a
34-
type or mimetype. Type corresponds to a .NET class that support
35-
text/value conversion through the TypeConverter architecture.
36-
Classes that don't support this are serialized and stored with the
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
3737
mimetype set.
38-
39-
The mimetype is used for serialized objects, and tells the
40-
ResXResourceReader how to depersist the object. This is currently not
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
4141
extensible. For a given mimetype the value must be set accordingly:
42-
43-
Note - application/x-microsoft.net.object.binary.base64 is the format
44-
that the ResXResourceWriter will generate, however the reader can
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
4545
read any of the formats listed below.
46-
46+
4747
mimetype: application/x-microsoft.net.object.binary.base64
48-
value : The object must be serialized with
48+
value : The object must be serialized with
4949
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
5050
: and then encoded with base64 encoding.
51-
51+
5252
mimetype: application/x-microsoft.net.object.soap.base64
53-
value : The object must be serialized with
53+
value : The object must be serialized with
5454
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
5555
: and then encoded with base64 encoding.
5656
5757
mimetype: application/x-microsoft.net.object.bytearray.base64
58-
value : The object must be serialized into a byte array
58+
value : The object must be serialized into a byte array
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->

0 commit comments

Comments
 (0)