Merge branch 'main' into MsgRecvEventArgs
This commit is contained in:
commit
4de570ea47
13
.gitignore
vendored
13
.gitignore
vendored
|
@ -1,7 +1,16 @@
|
|||
# .net build artiifacts
|
||||
bin/
|
||||
obj/
|
||||
/packages/
|
||||
|
||||
Lagrange.Core/Utility/Crypto/Provider/Dandelion/*.cs
|
||||
|
||||
# vscode files
|
||||
.vscode/
|
||||
|
||||
# rider files
|
||||
.idea/
|
||||
*.DotSettings.user
|
||||
riderModule.iml
|
||||
/_ReSharper.Caches/
|
||||
Lagrange.Core/Utility/Crypto/Provider/Dandelion/*.cs
|
||||
.vscode/
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class WtLoginTest
|
|||
var qrCode = await bot.FetchQrCode();
|
||||
if (qrCode != null)
|
||||
{
|
||||
await File.WriteAllBytesAsync("qr.png", qrCode);
|
||||
await File.WriteAllBytesAsync("qr.png", qrCode.Value.QrCode);
|
||||
await bot.LoginByQrCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ public static class BotExt
|
|||
/// <summary>
|
||||
/// Fetch the qrcode for QRCode Login
|
||||
/// </summary>
|
||||
/// <returns>the byte of QRCode, usually in the form of PNG</returns>
|
||||
public static async Task<byte[]?> FetchQrCode(this BotContext bot)
|
||||
=> await bot.ContextCollection.Business.WtExchangeLogic.FetchQrCode();
|
||||
/// <returns>return url and qrcode image in PNG format</returns>
|
||||
public static Task<(string Url, byte[] QrCode)?> FetchQrCode(this BotContext bot)
|
||||
=> bot.ContextCollection.Business.WtExchangeLogic.FetchQrCode();
|
||||
|
||||
/// <summary>
|
||||
/// Use this method to login by QrCode, you should call <see cref="FetchQrCode"/> first
|
||||
|
@ -20,8 +20,8 @@ public static class BotExt
|
|||
/// <summary>
|
||||
/// Use this method to login by password, EasyLogin may be preformed if there is sig in <see cref="BotKeystore"/>
|
||||
/// </summary>
|
||||
public static async Task<bool> LoginByPassword(this BotContext bot)
|
||||
=> await bot.ContextCollection.Business.WtExchangeLogic.LoginByPassword();
|
||||
public static Task<bool> LoginByPassword(this BotContext bot)
|
||||
=> bot.ContextCollection.Business.WtExchangeLogic.LoginByPassword();
|
||||
|
||||
/// <summary>
|
||||
/// Submit the captcha of the url given by the <see cref="EventInvoker.OnBotCaptchaEvent"/>
|
||||
|
|
|
@ -56,7 +56,7 @@ internal class WtExchangeLogic : LogicBase
|
|||
/// <para>1. resolve wtlogin.trans_emp CMD0x31 packet</para>
|
||||
/// <para>2. Schedule wtlogin.trans_emp CMD0x12 Task</para>
|
||||
/// </summary>
|
||||
public async Task<byte[]?> FetchQrCode()
|
||||
public async Task<(string, byte[])?> FetchQrCode()
|
||||
{
|
||||
Collection.Log.LogInfo(Tag, "Connecting Servers...");
|
||||
if (!await Collection.Socket.Connect()) return null;
|
||||
|
@ -73,7 +73,7 @@ internal class WtExchangeLogic : LogicBase
|
|||
Collection.Keystore.Session.QrUrl = @event.Url;
|
||||
|
||||
Collection.Log.LogInfo(Tag, $"QrCode Fetched, Expiration: {@event.Expiration} seconds");
|
||||
return @event.QrCode;
|
||||
return (@event.Url, @event.QrCode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -82,5 +82,11 @@ public sealed class MessageBuilder
|
|||
return this;
|
||||
}
|
||||
|
||||
public MessageBuilder Add(IMessageEntity entity)
|
||||
{
|
||||
_chain.Add(entity);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageChain Build() => _chain;
|
||||
}
|
|
@ -72,7 +72,7 @@ public class LagrangeApp : IHost
|
|||
var qrCode = await Instance.FetchQrCode();
|
||||
if (qrCode != null)
|
||||
{
|
||||
QrCodeHelper.Output(Instance.ContextCollection.Keystore.Session.QrUrl ?? "");
|
||||
QrCodeHelper.Output(qrCode.Value.Url ?? "");
|
||||
await Instance.LoginByQrCode();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue