Skip to content

Commit 26abeb4

Browse files
committed
让测试工具支持AOT中。。。
1 parent e2828b0 commit 26abeb4

File tree

12 files changed

+97
-4095
lines changed

12 files changed

+97
-4095
lines changed

QpTestClient/AboutBox.Designer.cs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QpTestClient/AboutBox.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ partial class AboutBox : Form
1515
public AboutBox()
1616
{
1717
InitializeComponent();
18+
var currentAssembly = this.GetType().Assembly;
19+
//窗体图标
20+
using (var stream = currentAssembly.GetManifestResourceStream($"{nameof(QpTestClient)}.Images.logo-large.png"))
21+
logoPictureBox.Image = Image.FromStream(stream);
1822
this.Text = String.Format("关于 {0}", ProductInfoUtils.GetAssemblyTitle());
1923
this.labelProductName.Text = ProductInfoUtils.GetAssemblyProduct();
2024
this.labelVersion.Text = $"版本 {ProductInfoUtils.GetAssemblyVersion()}";

QpTestClient/AboutBox.resx

Lines changed: 0 additions & 566 deletions
This file was deleted.

QpTestClient/ConnectForm.Designer.cs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QpTestClient/ConnectForm.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ public partial class ConnectForm : Form
2424
public ConnectForm()
2525
{
2626
InitializeComponent();
27+
var currentAssembly = this.GetType().Assembly;
28+
//窗体图标
29+
using (var stream = currentAssembly.GetManifestResourceStream($"{nameof(QpTestClient)}.Images.connection.ico"))
30+
Icon = new Icon(stream);
2731
}
2832

2933
public void EditConnectionInfo(TestConnectionInfo connectionInfo)
3034
{
3135
this.ConnectionInfo = XmlConvert.Deserialize<TestConnectionInfo>(XmlConvert.Serialize(connectionInfo));
3236
txtName.Text = connectionInfo.Name;
33-
var qpClientTypeInfo = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.QpClientType.FullName == connectionInfo.QpClientTypeName);
37+
var qpClientTypeInfo = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.ClientType.FullName == connectionInfo.QpClientTypeName);
3438
cbConnectType.SelectedItem = qpClientTypeInfo;
3539
Text = "编辑连接";
3640
}
@@ -45,7 +49,7 @@ private void ConnectForm_Load(object sender, EventArgs e)
4549
var qpClientTypeName = "Quick.Protocol.Tcp.QpTcpClient";
4650
if (ConnectionInfo != null)
4751
qpClientTypeName = ConnectionInfo.QpClientTypeName;
48-
var item = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.QpClientType.FullName == qpClientTypeName);
52+
var item = QpClientTypeManager.Instance.GetAll().FirstOrDefault(t => t.ClientType.FullName == qpClientTypeName);
4953
if (item != null)
5054
cbConnectType.SelectedItem = item;
5155
else
@@ -57,15 +61,15 @@ private void cbConnectType_SelectedIndexChanged(object sender, EventArgs e)
5761
var qpClientTypeInfo = (QpClientTypeInfo)cbConnectType.SelectedItem;
5862

5963
QpClientOptions options = null;
60-
if (ConnectionInfo != null && qpClientTypeInfo.QpClientType.FullName == ConnectionInfo.QpClientTypeName)
64+
if (ConnectionInfo != null && qpClientTypeInfo.ClientType.FullName == ConnectionInfo.QpClientTypeName)
6165
{
6266
options = (QpClientOptions)JsonSerializer.Deserialize(
6367
JsonSerializer.Serialize(ConnectionInfo.QpClientOptions),
64-
qpClientTypeInfo.QpClientOptionsType);
68+
qpClientTypeInfo.OptionsType);
6569
}
6670
else
6771
{
68-
options = (QpClientOptions)Activator.CreateInstance(qpClientTypeInfo.QpClientOptionsType);
72+
options = qpClientTypeInfo.CreateOptionsInstanceFunc();
6973
}
7074
pgOptions.SelectedObject = options;
7175
}
@@ -83,7 +87,7 @@ private void btnOk_Click(object sender, EventArgs e)
8387
ConnectionInfo = new TestConnectionInfo()
8488
{
8589
Name = name,
86-
QpClientTypeName = qpClientTypeInfo.QpClientType.FullName,
90+
QpClientTypeName = qpClientTypeInfo.ClientType.FullName,
8791
QpClientOptions = (QpClientOptions)pgOptions.SelectedObject,
8892
Instructions = ConnectionInfo?.Instructions
8993
};

0 commit comments

Comments
 (0)