Skip to content

Commit b0f8cc4

Browse files
committed
[NativeAPI] Part of Implement
1 parent 61a709f commit b0f8cc4

32 files changed

+889
-0
lines changed

Lagrange.Core.NativeAPI/Context.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Lagrange.Core.NativeAPI.ReverseEvent;
2+
3+
namespace Lagrange.Core.NativeAPI
4+
{
5+
public class Context
6+
{
7+
public Context(BotContext botContext)
8+
{
9+
BotContext = botContext;
10+
EventInvoker = new ReverseEventInvoker(BotContext);
11+
}
12+
public BotContext BotContext { get; set; }
13+
public ReverseEventInvoker EventInvoker { get; set; }
14+
}
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\Lagrange.Core\Lagrange.Core.csproj" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace Lagrange.Core.NativeAPI.NativeModel.Context
4+
{
5+
[StructLayout(LayoutKind.Sequential)]
6+
public struct BotConfigStruct
7+
{
8+
public BotConfigStruct()
9+
{
10+
}
11+
12+
public byte Protocol { get; set; } = 0b00000100;
13+
14+
public bool AutoReconnect { get; set; } = true;
15+
16+
public bool UseIPv6Network { get; set; } = false;
17+
18+
public bool GetOptimumServer { get; set; } = true;
19+
20+
public uint HighwayChunkSize { get; set; } = 1024 * 1024;
21+
22+
public uint HighwayConcurrent { get; set; } = 4;
23+
24+
public bool AutoReLogin { get; set; } = true;
25+
}
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace Lagrange.Core.NativeAPI.NativeModel.Common
2+
{
3+
public struct BotFriendCategoryStruct
4+
{
5+
public BotFriendCategoryStruct() { }
6+
7+
public int Id = 0;
8+
9+
public byte[] Name = [];
10+
11+
public int Count = 0;
12+
13+
public int SortId = 0;
14+
}
15+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using Lagrange.Core.NativeAPI.NativeModel.Common;
2+
3+
namespace Lagrange.Core.NativeAPI.NativeModel.Context
4+
{
5+
public struct BotKeystoreStruct
6+
{
7+
public BotKeystoreStruct() { }
8+
9+
public long Uin { get; set; } = 0;
10+
11+
public byte[] Uid { get; set; } = [];
12+
13+
public byte[] Guid { get; set; } = [];
14+
15+
public byte[] AndroidId { get; set; } = [];
16+
17+
public byte[] Qimei { get; set; } = [];
18+
19+
public byte[] DeviceName { get; set; } = [];
20+
21+
// WLoginSigs
22+
23+
public byte[] A2 { get; set; } = [];
24+
25+
public byte[] A2Key { get; set; } = new byte[16];
26+
27+
public byte[] D2 { get; set; } = [];
28+
29+
public byte[] D2Key { get; set; } = new byte[16];
30+
31+
public byte[] A1 { get; set; } = [];
32+
33+
public byte[] A1Key { get; set; } = new byte[16];
34+
35+
public byte[] NoPicSig { get; set; } = [];
36+
37+
public byte[] TgtgtKey { get; set; } = [];
38+
39+
public byte[] Ksid { get; set; } = [];
40+
41+
public byte[] SuperKey { get; set; } = [];
42+
43+
public byte[] StKey { get; set; } = [];
44+
45+
public byte[] StWeb { get; set; } = [];
46+
47+
public byte[] St { get; set; } = [];
48+
49+
public byte[] WtSessionTicket { get; set; } = [];
50+
51+
public byte[] WtSessionTicketKey { get; set; } = [];
52+
53+
public byte[] RandomKey { get; set; } = new byte[16];
54+
55+
public byte[] SKey { get; set; } = [];
56+
57+
public KeyValuePairNative<byte[], byte[]>[] PsKey { get; set; } = [];
58+
}
59+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace Lagrange.Core.NativeAPI.NativeModel.Common
4+
{
5+
[StructLayout(LayoutKind.Sequential)]
6+
public struct KeyValuePairNative<T1, T2>
7+
{
8+
public T1 Key;
9+
public T2 Value;
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Lagrange.Core.NativeAPI.NativeModel.Event
2+
{
3+
public struct BotCaptchaEventStruct : IEventStruct
4+
{
5+
public BotCaptchaEventStruct() { }
6+
7+
public byte[] CaptchaUrl = [];
8+
}
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace Lagrange.Core.NativeAPI.NativeModel.Event
4+
{
5+
[StructLayout(LayoutKind.Sequential)]
6+
public struct BotLogEventStruct : IEventStruct
7+
{
8+
public BotLogEventStruct() { }
9+
10+
public int Level = 0;
11+
public byte[] Tag = [];
12+
public byte[] Message = [];
13+
}
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace Lagrange.Core.NativeAPI.NativeModel.Event
4+
{
5+
[StructLayout(LayoutKind.Sequential)]
6+
public class BotLoginEventStruct : IEventStruct
7+
{
8+
public int State = 0;
9+
public byte[] Tag = [];
10+
public byte[] Message = [];
11+
}
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Lagrange.Core.NativeAPI.NativeModel.Common;
2+
using Lagrange.Core.NativeAPI.NativeModel.Message;
3+
4+
namespace Lagrange.Core.NativeAPI.NativeModel.Event
5+
{
6+
public struct BotMessageEventStruct : IEventStruct
7+
{
8+
public BotMessageEventStruct() { }
9+
10+
public BotMessageStruct Message = new();
11+
public byte[] RawMessage = [];
12+
}
13+
}

0 commit comments

Comments
 (0)