Skip to content

Commit 7546cfe

Browse files
committed
Add IQpModel and AbstractQpModel
1 parent 096fcbf commit 7546cfe

File tree

13 files changed

+97
-36
lines changed

13 files changed

+97
-36
lines changed

Quick.Protocol/Commands/Authenticate/Request.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
using System.ComponentModel;
1+
using Quick.Protocol.Model;
2+
using System.ComponentModel;
3+
using System.Text.Json.Serialization.Metadata;
24

35
namespace Quick.Protocol.Commands.Authenticate
46
{
57
[DisplayName("认证")]
6-
public class Request : IQpCommandRequest<Response>
8+
public class Request : AbstractQpModel<Request>, IQpCommandRequest<Response>
79
{
10+
protected override JsonTypeInfo<Request> TypeInfo => AuthenticateCommandSerializerContext.Default.Request;
11+
812
/// 认证回答
913
/// </summary>
1014
public string Answer { get; set; }
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
1+
using Quick.Protocol.Model;
2+
using System.Text.Json.Serialization.Metadata;
43

54
namespace Quick.Protocol.Commands.Authenticate
65
{
7-
public class Response
6+
public class Response : AbstractQpModel<Response>
87
{
8+
protected override JsonTypeInfo<Response> TypeInfo => AuthenticateCommandSerializerContext.Default.Response;
9+
910
}
1011
}

Quick.Protocol/Commands/Connect/Request.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using Quick.Protocol.Model;
32
using System.ComponentModel;
4-
using System.Text;
3+
using System.Text.Json.Serialization.Metadata;
54

65
namespace Quick.Protocol.Commands.Connect
76
{
87
/// <summary>
98
/// 连接请求命令
109
/// </summary>
1110
[DisplayName("连接")]
12-
public class Request : IQpCommandRequest<Response>
11+
public class Request : AbstractQpModel<Request>, IQpCommandRequest<Response>
1312
{
13+
protected override JsonTypeInfo<Request> TypeInfo => ConnectCommandSerializerContext.Default.Request;
1414
/// <summary>
1515
/// 指令集编号数组
1616
/// </summary>

Quick.Protocol/Commands/Connect/Response.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
1+
using Quick.Protocol.Model;
2+
using System.Text.Json.Serialization.Metadata;
43

54
namespace Quick.Protocol.Commands.Connect
65
{
76
/// <summary>
87
/// 连接响应命令
98
/// </summary>
10-
public class Response
9+
public class Response : AbstractQpModel<Response>
1110
{
11+
protected override JsonTypeInfo<Response> TypeInfo => ConnectCommandSerializerContext.Default.Response;
12+
1213
/// <summary>
1314
/// 缓存大小
1415
/// </summary>
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
using System.ComponentModel;
1+
using Quick.Protocol.Model;
2+
using System.ComponentModel;
3+
using System.Text.Json.Serialization.Metadata;
24

35
namespace Quick.Protocol.Commands.GetQpInstructions
46
{
57
/// <summary>
68
/// 获取全部指令集信息请求
79
/// </summary>
810
[DisplayName("获取全部指令集信息")]
9-
public class Request : IQpCommandRequest<Response>
11+
public class Request : AbstractQpModel<Request>, IQpCommandRequest<Response>
1012
{
13+
protected override JsonTypeInfo<Request> TypeInfo => GetQpInstructionsCommandSerializerContext.Default.Request;
1114
}
1215
}

Quick.Protocol/Commands/GetQpInstructions/Response.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
namespace Quick.Protocol.Commands.GetQpInstructions
1+
using Quick.Protocol.Model;
2+
using System.Text.Json.Serialization.Metadata;
3+
4+
namespace Quick.Protocol.Commands.GetQpInstructions
25
{
36
/// <summary>
47
/// 获取全部指令集信息响应
58
/// </summary>
6-
public class Response
9+
public class Response: AbstractQpModel<Response>
710
{
11+
protected override JsonTypeInfo<Response> TypeInfo => GetQpInstructionsCommandSerializerContext.Default.Response;
812
/// <summary>
913
/// 指令集数据
1014
/// </summary>

Quick.Protocol/Commands/HandShake/Request.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using Quick.Protocol.Model;
32
using System.ComponentModel;
4-
using System.Text;
3+
using System.Text.Json.Serialization.Metadata;
54

65
namespace Quick.Protocol.Commands.HandShake
76
{
87
[DisplayName("握手")]
9-
public class Request : IQpCommandRequest<Response>
8+
public class Request : AbstractQpModel<Request>, IQpCommandRequest<Response>
109
{
10+
protected override JsonTypeInfo<Request> TypeInfo => HandShakeCommandSerializerContext.Default.Request;
11+
1112
/// <summary>
1213
/// 传输超时(默认15秒)
1314
/// </summary>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
1+
using Quick.Protocol.Model;
2+
using System.Text.Json.Serialization.Metadata;
43

54
namespace Quick.Protocol.Commands.HandShake
65
{
7-
public class Response
6+
public class Response : AbstractQpModel<Response>
87
{
8+
protected override JsonTypeInfo<Response> TypeInfo => HandShakeCommandSerializerContext.Default.Response;
99
}
1010
}

Quick.Protocol/Commands/PrivateCommand/Request.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using Quick.Protocol.Model;
32
using System.ComponentModel;
4-
using System.Text;
3+
using System.Text.Json.Serialization.Metadata;
54

65
namespace Quick.Protocol.Commands.PrivateCommand
76
{
87
/// <summary>
98
/// 私有命令请求
109
/// </summary>
1110
[DisplayName("私有命令")]
12-
public class Request : IQpCommandRequest<Response>
11+
public class Request : AbstractQpModel<Request>, IQpCommandRequest<Response>
1312
{
13+
protected override JsonTypeInfo<Request> TypeInfo => PrivateCommandCommandSerializerContext.Default.Request;
1414
/// <summary>
1515
/// 动作
1616
/// </summary>

Quick.Protocol/Commands/PrivateCommand/Response.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
using System;
1+
using Quick.Protocol.Model;
2+
using System;
23
using System.Collections.Generic;
34
using System.Text;
5+
using System.Text.Json.Serialization.Metadata;
46

57
namespace Quick.Protocol.Commands.PrivateCommand
68
{
79
/// <summary>
810
/// 私有命令响应
911
/// </summary>
10-
public class Response
12+
public class Response : AbstractQpModel<Response>
1113
{
14+
protected override JsonTypeInfo<Response> TypeInfo => PrivateCommandCommandSerializerContext.Default.Response;
1215
/// <summary>
1316
/// 内容
1417
/// </summary>

0 commit comments

Comments
 (0)