Skip to content

Commit cb243e2

Browse files
committed
[NativeAPI] Fixed Freeing Memory Not Hold
1 parent 3bfc23c commit cb243e2

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lagrange.Core.NativeAPI/NativeModel/Common/BotKeystoreStruct.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,45 @@ public static implicit operator BotKeystoreStruct(BotKeystore keystore)
141141
PsKey = bytePsKey
142142
};
143143
}
144+
145+
public BotKeystore ToKeystoreWithoutFree()
146+
{
147+
var psKey = new Dictionary<string, string>();
148+
foreach (var kvp in PsKey)
149+
{
150+
psKey[Encoding.UTF8.GetString(kvp.Key)] = Encoding.UTF8.GetString(kvp.Value);
151+
}
152+
153+
return new BotKeystore()
154+
{
155+
Uin = Uin,
156+
Uid = Encoding.UTF8.GetString(Uid.ToByteArrayWithoutFree()),
157+
Guid = Guid.ToByteArrayWithoutFree(),
158+
AndroidId = Encoding.UTF8.GetString(AndroidId.ToByteArrayWithoutFree()),
159+
Qimei = Encoding.UTF8.GetString(Qimei.ToByteArrayWithoutFree()),
160+
DeviceName = Encoding.UTF8.GetString(DeviceName.ToByteArrayWithoutFree()),
161+
WLoginSigs = new WLoginSigs()
162+
{
163+
A2 = A2.ToByteArrayWithoutFree(),
164+
A2Key = A2Key.ToByteArrayWithoutFree(),
165+
D2 = D2.ToByteArrayWithoutFree(),
166+
D2Key = D2Key.ToByteArrayWithoutFree(),
167+
A1 = A1.ToByteArrayWithoutFree(),
168+
A1Key = A1Key.ToByteArrayWithoutFree(),
169+
NoPicSig = NoPicSig.ToByteArrayWithoutFree(),
170+
TgtgtKey = TgtgtKey.ToByteArrayWithoutFree(),
171+
Ksid = Ksid.ToByteArrayWithoutFree(),
172+
SuperKey = SuperKey.ToByteArrayWithoutFree(),
173+
StKey = StKey.ToByteArrayWithoutFree(),
174+
StWeb = StWeb.ToByteArrayWithoutFree(),
175+
St = St.ToByteArrayWithoutFree(),
176+
WtSessionTicket = WtSessionTicket.ToByteArrayWithoutFree(),
177+
WtSessionTicketKey = WtSessionTicketKey.ToByteArrayWithoutFree(),
178+
RandomKey = RandomKey.ToByteArrayWithoutFree(),
179+
SKey = SKey.ToByteArrayWithoutFree(),
180+
PsKey = psKey
181+
}
182+
};
183+
}
144184
}
145185
}

0 commit comments

Comments
 (0)