submodule对gitea不管用,所以直接拉了一份拉格兰

This commit is contained in:
2025-02-04 16:29:43 +08:00
parent b0bfc803e3
commit d149a2ea0f
1023 changed files with 43308 additions and 18 deletions

View File

@@ -0,0 +1,30 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x100)]
internal class Tlv100 : TlvBody
{
public Tlv100(BotAppInfo appInfo)
{
AppId = (uint)appInfo.AppId;
SubAppId = (uint)appInfo.SubAppId;
AppClientVersion = appInfo.AppClientVersion;
MainSigMap = appInfo.MainSigMap;
}
[BinaryProperty] public ushort DbBufVersion { get; set; } = 0; // originally 0x1
[BinaryProperty] public uint SsoVersion { get; set; } = 0x00000005;
[BinaryProperty] public uint AppId { get; set; }
[BinaryProperty] public uint SubAppId { get; set; }
[BinaryProperty] public uint AppClientVersion { get; set; }
[BinaryProperty] public uint MainSigMap { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X103)]
internal class Tlv103 : TlvBody
{
}

View File

@@ -0,0 +1,29 @@
using Lagrange.Core.Common;
using Lagrange.Core.Internal.Packets.Login.NTLogin.Plain.Body;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x106)]
internal class Tlv106 : TlvBody
{
/// <summary>
/// <para>manually construct Tlv106 by tempPassword, from TlvQrCode18, not through dependency injection</para>
/// <para>This field does not only use as the request, but also response</para>
/// <para>Response should be referred to <see cref="SsoNTLoginEasyLogin"/></para>
/// <para>Password is depreciated, so such field is now injected through dependency injection</para>
/// </summary>
public Tlv106(BotKeystore keystore) => Temp = keystore.Session.TempPassword ?? throw new ArgumentNullException(nameof(keystore.Session.TempPassword));
[BinaryProperty(Prefix.None)] public byte[] Temp { get; set; }
}
[Tlv(0x106, true)]
internal class Tlv106Response : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] Temp { get; set; }
}

View File

@@ -0,0 +1,17 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x107)]
internal class Tlv107 : TlvBody
{
[BinaryProperty] public ushort PicType { get; set; } = 0x0001;
[BinaryProperty] public byte CapType { get; set; } = 0x0D;
[BinaryProperty] public ushort PicSize { get; set; } = 0x0000;
[BinaryProperty] public byte RetType { get; set; } = 0x01;
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x108)]
internal class Tlv108 : TlvBody
{
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x10A)]
internal class Tlv10A : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] Tgt { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x10C)]
internal class Tlv10C : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X10D)]
internal class Tlv10D : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X10E)]
internal class Tlv10E : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x011)]
internal class Tlv11 : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X114)]
internal class Tlv114 : TlvBody
{
}

View File

@@ -0,0 +1,26 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
using BitConverter = Lagrange.Core.Utility.Binary.BitConverter;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x116)]
internal class Tlv116 : TlvBody
{
public Tlv116(BotAppInfo appInfo) => SubSigMap = appInfo.SubSigMap;
private static readonly uint[] AppIds = { };
[BinaryProperty] public byte Version { get; set; } = 0;
[BinaryProperty] public uint MiscBitmap { get; set; } = 12058620;
[BinaryProperty] public uint SubSigMap { get; set; }
[BinaryProperty] public byte AppIdCount { get; set; } = (byte)AppIds.Length;
[BinaryProperty(Prefix.None)] public byte[] AppIdBytes =>
AppIds.Select(x => BitConverter.GetBytes(x, false)).SelectMany(x => x).ToArray();
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X118)]
internal class Tlv118 : TlvBody
{
}

View File

@@ -0,0 +1,15 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x119)]
internal class Tlv119 : TlvBody
{
/// <summary>
/// The encrypted TLV data that should be decrypted with the TGTGT key.
/// </summary>
[BinaryProperty(Prefix.None)] public byte[] EncryptedTlv { get; set; }
}

View File

@@ -0,0 +1,18 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X11A)]
internal class Tlv11A : TlvBody
{
[BinaryProperty] public ushort FaceId { get; set; }
[BinaryProperty] public byte Age { get; set; }
[BinaryProperty] public byte Gender { get; set; }
[BinaryProperty(Prefix.Uint8 | Prefix.None)] public string Nickname { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X11F)]
internal class Tlv11F : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x012)]
internal class Tlv12 : TlvBody
{
}

View File

@@ -0,0 +1,11 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x124)]
internal class Tlv124 : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] Field0 { get; set; } = new byte[12];
}

View File

@@ -0,0 +1,32 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x128)]
internal class Tlv128 : TlvBody
{
public Tlv128(BotAppInfo appInfo, BotDeviceInfo deviceInfo)
{
Os = appInfo.Os;
Guid = deviceInfo.Guid.ToByteArray();
}
[BinaryProperty] public ushort Const0 { get; set; } = 0;
[BinaryProperty] public byte GuidNew { get; set; } = 0;
[BinaryProperty] public byte GuidAvailable { get; set; } = 0;
[BinaryProperty] public byte GuidChanged { get; set; } = 0;
[BinaryProperty] public uint GuidFlag { get; set; } = 0;
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string Os { get; set; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public byte[] Guid { get; set; }
[BinaryProperty] public ushort Const1 { get; set; } = 0;
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X130)]
internal class Tlv130 : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X133)]
internal class Tlv133 : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X134)]
internal class Tlv134 : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X138)]
internal class Tlv138 : TlvBody
{
}

View File

@@ -0,0 +1,17 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x141)]
internal class Tlv141 : TlvBody
{
[BinaryProperty] public ushort Version { get; set; } = 0;
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string Unknown { get; set; } = "Unknown";
[BinaryProperty] public ushort NetworkType { get; set; } = 0;
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string Apn { get; set; } = "";
}

View File

@@ -0,0 +1,16 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x142)]
internal class Tlv142 : TlvBody
{
public Tlv142(BotAppInfo appInfo) => PackageName = appInfo.PackageName;
[BinaryProperty] public ushort Version { get; set; } = 0;
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string PackageName { get; set; }
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X143)]
internal class Tlv143 : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] D2 { get; set; }
}

View File

@@ -0,0 +1,30 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x144)]
[TlvEncrypt(TlvEncryptAttribute.KeyType.TgtgtKey)]
internal class Tlv144 : TlvBody
{
public Tlv144(BotAppInfo appInfo, BotDeviceInfo deviceInfo)
{
TlvCount = 4;
Tlv16E = new TlvPacket(0x16E, new Tlv16E(deviceInfo)).ToArray();
Tlv147 = new TlvPacket(0x147, new Tlv147(appInfo)).ToArray();
Tlv128 = new TlvPacket(0x128, new Tlv128(appInfo, deviceInfo)).ToArray();
Tlv124 = new TlvPacket(0x124, new Tlv124()).ToArray();
}
[BinaryProperty] public ushort TlvCount { get; set; }
[BinaryProperty] public byte[] Tlv16E { get; set; }
[BinaryProperty] public byte[] Tlv147 { get; set; }
[BinaryProperty] public byte[] Tlv128 { get; set; }
[BinaryProperty] public byte[] Tlv124 { get; set; }
}

View File

@@ -0,0 +1,14 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x145)]
internal class Tlv145 : TlvBody
{
public Tlv145(BotDeviceInfo deviceInfo) => Guid = deviceInfo.Guid.ToByteArray();
[BinaryProperty(Prefix.None)] public byte[] Guid { get; set; }
}

View File

@@ -0,0 +1,18 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x146)]
internal class Tlv146 : TlvBody
{
[BinaryProperty] public uint State { get; set; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string Tag { get; set; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string Message { get; set; }
[BinaryProperty] public uint Field0 { get; set; }
}

View File

@@ -0,0 +1,23 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x147)]
internal class Tlv147 : TlvBody
{
public Tlv147(BotAppInfo appInfo)
{
AppId = (uint)appInfo.AppId;
PtVersion = appInfo.PtVersion;
PackageName = appInfo.PackageName;
}
[BinaryProperty] public uint AppId { get; set; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string PtVersion { get; set; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string PackageName { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x161)]
internal class Tlv161 : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X163)]
internal class Tlv163 : TlvBody
{
}

View File

@@ -0,0 +1,11 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x166)]
internal class Tlv166 : TlvBody
{
[BinaryProperty] public byte ImageType { get; set; } = 5;
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X167)]
internal class Tlv167 : TlvBody
{
}

View File

@@ -0,0 +1,27 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x16A)]
internal class Tlv16A : TlvBody
{
/// <summary>
/// Tlv0x16A <see cref="TlvQrCode19"/>
/// </summary>
public Tlv16A(BotKeystore keystore)
{
NoPicSig = keystore.Session.NoPicSig ?? Array.Empty<byte>();
}
[BinaryProperty(Prefix.None)] public byte[] NoPicSig { get; set; }
}
[Tlv(0x16A, true)]
internal class Tlv16AResponse : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] NoPicSig { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X16D)]
internal class Tlv16D : TlvBody
{
}

View File

@@ -0,0 +1,14 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x16E)]
internal class Tlv16E : TlvBody
{
public Tlv16E(BotDeviceInfo deviceInfo) => DeviceName = deviceInfo.DeviceName;
[BinaryProperty(Prefix.None)] public string DeviceName { get; set; }
}

View File

@@ -0,0 +1,18 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x177)]
internal class Tlv177 : TlvBody
{
public Tlv177(BotAppInfo appInfo) => WtLoginSdk = appInfo.WtLoginSdk;
[BinaryProperty] public byte Field1 { get; set; } = 1;
[BinaryProperty] public uint BuildTime { get; set; } = 0; // const 0, not sure what this is
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string WtLoginSdk { get; set; }
}

View File

@@ -0,0 +1,27 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x018)]
internal class Tlv18 : TlvBody
{
public Tlv18(BotKeystore keystore) => Uin = keystore.Uin;
[BinaryProperty] public ushort PingVersion { get; set; } = 0;
[BinaryProperty] public uint SsoVersion { get; set; } = 0x00000005;
[BinaryProperty] public uint AppId { get; set; } = 0; // const 0, not sure what this is
[BinaryProperty] public uint AppClientVersion { get; set; } = 8001;
[BinaryProperty] public uint Uin { get; set; }
[BinaryProperty] public ushort Field0 { get; set; } = 0;
[BinaryProperty] public ushort Field1 { get; set; } = 0;
}

View File

@@ -0,0 +1,11 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x191)]
internal class Tlv191 : TlvBody
{
[BinaryProperty] public byte K { get; set; } = 0; // originally 0x82
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X305)]
internal class Tlv305 : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] D2Key { get; set; }
}

View File

@@ -0,0 +1,11 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x318)]
internal class Tlv318 : TlvBody
{
// Just empty
// after discovered, NTQQ has already depreciated this tlv
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x508)]
internal class Tlv508 : TlvBody
{
// 猜不透 算了
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X510)]
internal class Tlv510 : TlvBody
{
}

View File

@@ -0,0 +1,13 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x521)]
internal class Tlv521 : TlvBody
{
[BinaryProperty] public uint ProductType { get; set; } = 0x13;
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string ProductDesc { get; set; } = "basicim";
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X523)]
internal class Tlv523 : TlvBody
{
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X528)]
internal class Tlv528 : TlvBody
{
}

View File

@@ -0,0 +1,25 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
using ProtoBuf;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0x543)]
[ProtoContract]
internal class Tlv543 : TlvBody
{
[ProtoMember(9)] public Tlv543Layer1 Layer1 { get; set; }
}
[ProtoContract]
internal class Tlv543Layer1
{
[ProtoMember(11)] public Tlv543Layer2 Layer2 { get; set; }
}
[ProtoContract]
internal class Tlv543Layer2
{
[ProtoMember(1)] public string Uid { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[Tlv(0X550)]
internal class Tlv550 : TlvBody
{
}

View File

@@ -0,0 +1,17 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x11)]
internal class TlvQrCode11 : TlvBody
{
public TlvQrCode11(BotKeystore keystore)
{
UnusualSign = keystore.Session.UnusualSign ?? throw new InvalidOperationException();
}
[BinaryProperty(Prefix.None)] public byte[] UnusualSign { get; set; }
}

View File

@@ -0,0 +1,8 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x012)]
internal class TlvQrCode12 : TlvBody { }

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x015)]
internal class TlvQrCode15 : TlvBody
{
}

View File

@@ -0,0 +1,34 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x016)]
internal class Tlv16QrCode : TlvBody
{
public Tlv16QrCode(BotAppInfo appInfo, BotDeviceInfo deviceInfo)
{
SubAppId = (uint)appInfo.AppId;
AppIdQrCode = (uint)appInfo.AppIdQrCode;
Guid = deviceInfo.Guid.ToByteArray();
PackageName = appInfo.PackageName;
PtVersion = appInfo.PtVersion;
PackageName2 = appInfo.PackageName;
}
[BinaryProperty] public uint Field0 { get; } = 0; // unknown
[BinaryProperty] public uint SubAppId { get; }
[BinaryProperty] public uint AppIdQrCode { get; }
[BinaryProperty(Prefix.None)] public byte[] Guid { get; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string PackageName { get; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string PtVersion { get; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string PackageName2 { get; }
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x017)]
internal class TlvQrCode17 : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] QrCode { get; set; }
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x018)]
internal class TlvQrCode18 : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] TempPassword { get; set; }
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x019)]
internal class TlvQrCode19 : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] NoPicSig { get; set; }
}

View File

@@ -0,0 +1,25 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x01b)]
internal class TlvQrCode1B : TlvBody
{
[BinaryProperty] public uint Micro { get; set; } = 0;
[BinaryProperty] public uint Version { get; set; } = 0;
[BinaryProperty] public uint Size { get; set; } = 3;
[BinaryProperty] public uint Margin { get; set; } = 4;
[BinaryProperty] public uint Dpi { get; set; } = 72;
[BinaryProperty] public uint EcLevel { get; set; } = 2;
[BinaryProperty] public uint Hint { get; set; } = 2;
[BinaryProperty] public ushort Field0 { get; set; } = 0;
}

View File

@@ -0,0 +1,13 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x01c)]
internal class TlvQrCode1C : TlvBody
{
[BinaryProperty] public uint ExpireSec { get; set; }
[BinaryProperty] public ushort ExpireMin { get; set; }
}

View File

@@ -0,0 +1,23 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
/// <summary>
/// Different from oicq
/// </summary>
[TlvQrCode(0x01d)]
internal class TlvQrCode1D : TlvBody
{
public TlvQrCode1D(BotAppInfo appInfo) => MiscBitmap = (uint)appInfo.MiscBitmap;
[BinaryProperty] public byte FieldByte { get; set; } = 1;
[BinaryProperty] public uint MiscBitmap { get; set; }
[BinaryProperty] public uint Field0 { get; set; } = 0;
[BinaryProperty] public byte FieldByte0 { get; set; } = 0;
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x01e)]
internal class TlvQrCode1E : TlvBody
{
[BinaryProperty(Prefix.None)] public byte[] TgtgtKey { get; set; } // a1_sig
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x002)]
internal class TlvQrCode2 : TlvBody
{
}

View File

@@ -0,0 +1,14 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x033)]
internal class TlvQrCode33 : TlvBody
{
public TlvQrCode33(BotDeviceInfo deviceInfo) => Guid = deviceInfo.Guid.ToByteArray();
[BinaryProperty(Prefix.None)] public byte[] Guid { get; }
}

View File

@@ -0,0 +1,14 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x035)]
internal class TlvQrCode35 : TlvBody
{
public TlvQrCode35(BotAppInfo appInfo) => PtOsVersion = appInfo.SsoVersion;
[BinaryProperty] public int PtOsVersion { get; }
}

View File

@@ -0,0 +1,14 @@
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x004)]
internal class TlvQrCode4 : TlvBody
{
[BinaryProperty] public ushort Type { get; set; }
[BinaryProperty(Prefix.Uint16 | Prefix.LengthOnly)] public string Uin { get; set; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x065)]
internal class TlvQrCode65 : TlvBody
{
// Just Empty
}

View File

@@ -0,0 +1,14 @@
using Lagrange.Core.Common;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x066)]
internal class TlvQrCode66 : TlvBody
{
public TlvQrCode66(BotAppInfo appInfo) => PtOsVersion = appInfo.SsoVersion;
[BinaryProperty] public int PtOsVersion { get; }
}

View File

@@ -0,0 +1,10 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x007)]
internal class Tlv7 : TlvBody
{
}

View File

@@ -0,0 +1,12 @@
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
// ReSharper disable InconsistentNaming
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x0CE)]
internal class TlvQrCodeCE : TlvBody
{
}

View File

@@ -0,0 +1,36 @@
using Lagrange.Core.Common;
using Lagrange.Core.Internal.Packets.System;
using Lagrange.Core.Utility.Binary.Tlv;
using Lagrange.Core.Utility.Binary.Tlv.Attributes;
using ProtoBuf;
#pragma warning disable CS8618
namespace Lagrange.Core.Internal.Packets.Tlv;
[TlvQrCode(0x0d1)]
[ProtoContract]
internal class TlvQrCodeD1 : TlvBody
{
public TlvQrCodeD1(BotAppInfo appInfo, BotDeviceInfo deviceInfo)
{
Sys = new NTOS
{
Name = deviceInfo.DeviceName,
OS = appInfo.Os,
};
Type = new byte[] { 0x30, 0x01 }; // actually there is a type ext but i'm too lazy to implement it so i just hardcode it
}
[ProtoMember(1)] public NTOS Sys { get; set; }
[ProtoMember(4)] public byte[] Type { get; set; }
}
[TlvQrCode(0x0d1, true)]
[ProtoContract]
internal class TlvQrCodeD1Resp : TlvBody
{
[ProtoMember(2)] public string Url { get; set; }
[ProtoMember(3)] public string QrSig { get; set; }
}