1+ using System . Text ;
2+ using Lagrange . Core . Common ;
13using Lagrange . Core . NativeAPI . NativeModel . Common ;
24
35namespace Lagrange . Core . NativeAPI . NativeModel . Context
@@ -6,54 +8,138 @@ public struct BotKeystoreStruct
68 {
79 public BotKeystoreStruct ( ) { }
810
9- public long Uin { get ; set ; } = 0 ;
11+ public long Uin = 0 ;
1012
11- public byte [ ] Uid { get ; set ; } = [ ] ;
13+ public ByteArrayNative Uid = new ( ) ;
1214
13- public byte [ ] Guid { get ; set ; } = [ ] ;
15+ public ByteArrayNative Guid = new ( ) ;
1416
15- public byte [ ] AndroidId { get ; set ; } = [ ] ;
17+ public ByteArrayNative AndroidId = new ( ) ;
1618
17- public byte [ ] Qimei { get ; set ; } = [ ] ;
19+ public ByteArrayNative Qimei = new ( ) ;
1820
19- public byte [ ] DeviceName { get ; set ; } = [ ] ;
21+ public ByteArrayNative DeviceName = new ( ) ;
2022
2123 // WLoginSigs
2224
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 ; } = [ ] ;
25+ public ByteArrayNative A2 = new ( ) ;
26+
27+ public ByteArrayNative A2Key = new byte [ 16 ] ;
28+
29+ public ByteArrayNative D2 = new ( ) ;
30+
31+ public ByteArrayNative D2Key = new byte [ 16 ] ;
32+
33+ public ByteArrayNative A1 = new ( ) ;
34+
35+ public ByteArrayNative A1Key = new byte [ 16 ] ;
36+
37+ public ByteArrayNative NoPicSig = new ( ) ;
38+
39+ public ByteArrayNative TgtgtKey = new ( ) ;
40+
41+ public ByteArrayNative Ksid = new ( ) ;
42+
43+ public ByteArrayNative SuperKey = new ( ) ;
44+
45+ public ByteArrayNative StKey = new ( ) ;
46+
47+ public ByteArrayNative StWeb = new ( ) ;
48+
49+ public ByteArrayNative St = new ( ) ;
50+
51+ public ByteArrayNative WtSessionTicket = new ( ) ;
52+
53+ public ByteArrayNative WtSessionTicketKey = new ( ) ;
54+
55+ public ByteArrayNative RandomKey = new byte [ 16 ] ;
56+
57+ public ByteArrayNative SKey = new ( ) ;
58+
59+ public KeyValuePairNative < ByteArrayNative , ByteArrayNative > [ ] PsKey = [ ] ;
60+
61+ public static implicit operator BotKeystore ( BotKeystoreStruct keystore )
62+ {
63+ var psKey = new Dictionary < string , string > ( ) ;
64+ foreach ( var kvp in keystore . PsKey )
65+ {
66+ psKey [ Encoding . UTF8 . GetString ( kvp . Key ) ] = Encoding . UTF8 . GetString ( kvp . Value ) ;
67+ }
68+
69+ return new BotKeystore ( )
70+ {
71+ Uin = keystore . Uin ,
72+ Uid = Encoding . UTF8 . GetString ( keystore . Uid ) ,
73+ Guid = keystore . Guid ,
74+ AndroidId = Encoding . UTF8 . GetString ( keystore . AndroidId ) ,
75+ Qimei = Encoding . UTF8 . GetString ( keystore . Qimei ) ,
76+ DeviceName = Encoding . UTF8 . GetString ( keystore . DeviceName ) ,
77+ WLoginSigs = new WLoginSigs ( )
78+ {
79+ A2 = keystore . A2 ,
80+ A2Key = keystore . A2Key ,
81+ D2 = keystore . D2 ,
82+ D2Key = keystore . D2Key ,
83+ A1 = keystore . A1 ,
84+ A1Key = keystore . A1Key ,
85+ NoPicSig = keystore . NoPicSig ,
86+ TgtgtKey = keystore . TgtgtKey ,
87+ Ksid = keystore . Ksid ,
88+ SuperKey = keystore . SuperKey ,
89+ StKey = keystore . StKey ,
90+ StWeb = keystore . StWeb ,
91+ St = keystore . St ,
92+ WtSessionTicket = keystore . WtSessionTicket ,
93+ WtSessionTicketKey = keystore . WtSessionTicketKey ,
94+ RandomKey = keystore . RandomKey ,
95+ SKey = keystore . SKey ,
96+ PsKey = psKey
97+ }
98+ } ;
99+ }
100+
101+ public static implicit operator BotKeystoreStruct ( BotKeystore keystore )
102+ {
103+ var bytePsKey = new KeyValuePairNative < ByteArrayNative , ByteArrayNative > [
104+ keystore . WLoginSigs . PsKey . Count
105+ ] ;
106+ int i = 0 ;
107+ foreach ( var kvp in keystore . WLoginSigs . PsKey )
108+ {
109+ bytePsKey [ i ++ ] = new KeyValuePairNative < ByteArrayNative , ByteArrayNative > ( )
110+ {
111+ Key = Encoding . UTF8 . GetBytes ( kvp . Key ) ,
112+ Value = Encoding . UTF8 . GetBytes ( kvp . Value )
113+ } ;
114+ }
115+
116+ return new BotKeystoreStruct ( )
117+ {
118+ Uin = keystore . Uin ,
119+ Uid = Encoding . UTF8 . GetBytes ( keystore . Uid ) ,
120+ Guid = keystore . Guid ,
121+ AndroidId = Encoding . UTF8 . GetBytes ( keystore . AndroidId ) ,
122+ Qimei = Encoding . UTF8 . GetBytes ( keystore . Qimei ) ,
123+ DeviceName = Encoding . UTF8 . GetBytes ( keystore . DeviceName ) ,
124+ A2 = keystore . WLoginSigs . A2 ,
125+ A2Key = keystore . WLoginSigs . A2Key ,
126+ D2 = keystore . WLoginSigs . D2 ,
127+ D2Key = keystore . WLoginSigs . D2Key ,
128+ A1 = keystore . WLoginSigs . A1 ,
129+ A1Key = keystore . WLoginSigs . A1Key ,
130+ NoPicSig = keystore . WLoginSigs . NoPicSig ,
131+ TgtgtKey = keystore . WLoginSigs . TgtgtKey ,
132+ Ksid = keystore . WLoginSigs . Ksid ,
133+ SuperKey = keystore . WLoginSigs . SuperKey ,
134+ StKey = keystore . WLoginSigs . StKey ,
135+ StWeb = keystore . WLoginSigs . StWeb ,
136+ St = keystore . WLoginSigs . St ,
137+ WtSessionTicket = keystore . WLoginSigs . WtSessionTicket ,
138+ WtSessionTicketKey = keystore . WLoginSigs . WtSessionTicketKey ,
139+ RandomKey = keystore . WLoginSigs . RandomKey ,
140+ SKey = keystore . WLoginSigs . SKey ,
141+ PsKey = bytePsKey
142+ } ;
143+ }
58144 }
59145}
0 commit comments