Skip to content

Commit 82691b7

Browse files
committed
First commit.
1 parent eda89f3 commit 82691b7

39 files changed

+1081
-0
lines changed

logo.png

21.8 KB
Loading

src/.gitignore

+454
Large diffs are not rendered by default.

src/Directory.Build.props

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Nullable>enable</Nullable>
4+
<AvaloniaVersion>11.0.2</AvaloniaVersion>
5+
</PropertyGroup>
6+
</Project>

src/QpFile.Protocol/Instruction.cs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Quick.Protocol;
2+
3+
namespace QpFile.Protocol
4+
{
5+
public class Instruction
6+
{
7+
public static QpInstruction Instance = new QpInstruction()
8+
{
9+
Id = typeof(Instruction).Namespace,
10+
Name = "QpFile Protocol",
11+
CommandInfos = new[]
12+
{
13+
QpCommandInfo.Create(new QpCommands.Login.Request()),
14+
QpCommandInfo.Create(new QpCommands.ListFolder.Request()),
15+
QpCommandInfo.Create(new QpCommands.CreateFolder.Request()),
16+
QpCommandInfo.Create(new QpCommands.Delete.Request()),
17+
QpCommandInfo.Create(new QpCommands.BeginUploadFile.Request()),
18+
QpCommandInfo.Create(new QpCommands.EndUploadFile.Request()),
19+
QpCommandInfo.Create(new QpCommands.BeginDownloadFile.Request()),
20+
QpCommandInfo.Create(new QpCommands.EndDownloadFile.Request())
21+
},
22+
NoticeInfos = new[]
23+
{
24+
QpNoticeInfo.Create(new QpNotices.FilePartInfo())
25+
}
26+
};
27+
}
28+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace QpFile.Protocol.Model
8+
{
9+
public class QpFileInfo
10+
{
11+
/// <summary>
12+
/// 名称
13+
/// </summary>
14+
public string Name { get; set; }
15+
/// <summary>
16+
/// 完整名称
17+
/// </summary>
18+
public string FullName { get; set; }
19+
/// <summary>
20+
/// 大小
21+
/// </summary>
22+
public long Length { get; set; }
23+
/// <summary>
24+
/// 最后写入时间
25+
/// </summary>
26+
public DateTime LastWriteTime { get; set; }
27+
}
28+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace QpFile.Protocol.Model
8+
{
9+
public class QpFolderInfo
10+
{
11+
/// <summary>
12+
/// 名称
13+
/// </summary>
14+
public string Name { get; set; }
15+
/// <summary>
16+
/// 完整名称
17+
/// </summary>
18+
public string FullName { get; set; }
19+
/// <summary>
20+
/// 最后写入时间
21+
/// </summary>
22+
public DateTime LastWriteTime { get; set; }
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.BeginDownloadFile
11+
{
12+
[DisplayName("Begin download folder")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => BeginDownloadFileCommandSerializerContext.Default.Request;
16+
public string File { get; set; }
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Quick.Protocol;
2+
using System.Text.Json.Serialization.Metadata;
3+
4+
namespace QpFile.Protocol.QpCommands.BeginDownloadFile
5+
{
6+
public class Response : AbstractQpSerializer<Response>
7+
{
8+
protected override JsonTypeInfo<Response> GetTypeInfo() => BeginDownloadFileCommandSerializerContext.Default.Response;
9+
public string FileId { get; set; }
10+
public string Length { get; set; }
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.BeginUploadFile
11+
{
12+
[DisplayName("Begin upload folder")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => BeginUploadFileCommandSerializerContext.Default.Request;
16+
public string Folder { get; set; }
17+
public string FileName { get; set; }
18+
public long FileLength { get; set; }
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Quick.Protocol;
2+
using System.Text.Json.Serialization.Metadata;
3+
4+
namespace QpFile.Protocol.QpCommands.BeginUploadFile
5+
{
6+
public class Response : AbstractQpSerializer<Response>
7+
{
8+
protected override JsonTypeInfo<Response> GetTypeInfo() => BeginUploadFileCommandSerializerContext.Default.Response;
9+
public string FileId { get; set; }
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace QpFile.Protocol.QpCommands;
4+
5+
[JsonSerializable(typeof(ListFolder.Request))]
6+
[JsonSerializable(typeof(ListFolder.Response))]
7+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
8+
internal partial class ListFolderCommandSerializerContext : JsonSerializerContext { }
9+
10+
[JsonSerializable(typeof(Login.Request))]
11+
[JsonSerializable(typeof(Login.Response))]
12+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
13+
internal partial class LoginCommandSerializerContext : JsonSerializerContext { }
14+
15+
[JsonSerializable(typeof(CreateFolder.Request))]
16+
[JsonSerializable(typeof(CreateFolder.Response))]
17+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
18+
internal partial class CreateFolderCommandSerializerContext : JsonSerializerContext { }
19+
20+
[JsonSerializable(typeof(Delete.Request))]
21+
[JsonSerializable(typeof(Delete.Response))]
22+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
23+
internal partial class DeleteCommandSerializerContext : JsonSerializerContext { }
24+
25+
[JsonSerializable(typeof(BeginUploadFile.Request))]
26+
[JsonSerializable(typeof(BeginUploadFile.Response))]
27+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
28+
internal partial class BeginUploadFileCommandSerializerContext : JsonSerializerContext { }
29+
30+
[JsonSerializable(typeof(EndUploadFile.Request))]
31+
[JsonSerializable(typeof(EndUploadFile.Response))]
32+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
33+
internal partial class EndUploadFileCommandSerializerContext : JsonSerializerContext { }
34+
35+
[JsonSerializable(typeof(BeginDownloadFile.Request))]
36+
[JsonSerializable(typeof(BeginDownloadFile.Response))]
37+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
38+
internal partial class BeginDownloadFileCommandSerializerContext : JsonSerializerContext { }
39+
40+
[JsonSerializable(typeof(EndDownloadFile.Request))]
41+
[JsonSerializable(typeof(EndDownloadFile.Response))]
42+
[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
43+
internal partial class EndDownloadFileCommandSerializerContext : JsonSerializerContext { }
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.CreateFolder
11+
{
12+
[DisplayName("Create folder")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => CreateFolderCommandSerializerContext.Default.Request;
16+
17+
public string Folder { get; set; }
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using QpFile.Protocol.Model;
2+
using Quick.Protocol;
3+
using System.Text.Json.Serialization.Metadata;
4+
5+
namespace QpFile.Protocol.QpCommands.CreateFolder
6+
{
7+
public class Response : AbstractQpSerializer<Response>
8+
{
9+
protected override JsonTypeInfo<Response> GetTypeInfo() => CreateFolderCommandSerializerContext.Default.Response;
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.Delete
11+
{
12+
[DisplayName("Delete folder or file")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => DeleteCommandSerializerContext.Default.Request;
16+
17+
public string Path { get; set; }
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using QpFile.Protocol.Model;
2+
using Quick.Protocol;
3+
using System.Text.Json.Serialization.Metadata;
4+
5+
namespace QpFile.Protocol.QpCommands.Delete
6+
{
7+
public class Response : AbstractQpSerializer<Response>
8+
{
9+
protected override JsonTypeInfo<Response> GetTypeInfo() => DeleteCommandSerializerContext.Default.Response;
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.EndDownloadFile
11+
{
12+
[DisplayName("End download folder")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => EndDownloadFileCommandSerializerContext.Default.Request;
16+
public string FileId { get; set; }
17+
public DateTime LastWriteTime { get; set; }
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Quick.Protocol;
2+
using System.Text.Json.Serialization.Metadata;
3+
4+
namespace QpFile.Protocol.QpCommands.EndDownloadFile
5+
{
6+
public class Response : AbstractQpSerializer<Response>
7+
{
8+
protected override JsonTypeInfo<Response> GetTypeInfo() => EndDownloadFileCommandSerializerContext.Default.Response;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.EndUploadFile
11+
{
12+
[DisplayName("End upload folder")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => EndUploadFileCommandSerializerContext.Default.Request;
16+
public string FileId { get; set; }
17+
public DateTime LastWriteTime { get; set; }
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Quick.Protocol;
2+
using System.Text.Json.Serialization.Metadata;
3+
4+
namespace QpFile.Protocol.QpCommands.EndUploadFile
5+
{
6+
public class Response : AbstractQpSerializer<Response>
7+
{
8+
protected override JsonTypeInfo<Response> GetTypeInfo() => EndUploadFileCommandSerializerContext.Default.Response;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.ListFolder
11+
{
12+
[DisplayName("List folder")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => ListFolderCommandSerializerContext.Default.Request;
16+
17+
public string Folder { get; set; }
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using QpFile.Protocol.Model;
2+
using Quick.Protocol;
3+
using System.Text.Json.Serialization.Metadata;
4+
5+
namespace QpFile.Protocol.QpCommands.ListFolder
6+
{
7+
public class Response : AbstractQpSerializer<Response>
8+
{
9+
protected override JsonTypeInfo<Response> GetTypeInfo() => ListFolderCommandSerializerContext.Default.Response;
10+
11+
public QpFolderInfo[] Folders { get; set; }
12+
public QpFileInfo[] Files { get; set; }
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Text.Json.Serialization.Metadata;
8+
using System.Threading.Tasks;
9+
10+
namespace QpFile.Protocol.QpCommands.Login
11+
{
12+
[DisplayName("Login")]
13+
public class Request : AbstractQpSerializer<Request>, IQpCommandRequest<Request, Response>
14+
{
15+
protected override JsonTypeInfo<Request> GetTypeInfo() => LoginCommandSerializerContext.Default.Request;
16+
public string User { get; set; }
17+
public string Password { get; set; }
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Quick.Protocol;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Text.Json.Serialization.Metadata;
7+
using System.Threading.Tasks;
8+
9+
namespace QpFile.Protocol.QpCommands.Login
10+
{
11+
public class Response : AbstractQpSerializer<Response>
12+
{
13+
protected override JsonTypeInfo<Response> GetTypeInfo() => LoginCommandSerializerContext.Default.Response;
14+
15+
}
16+
}

0 commit comments

Comments
 (0)