mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfc8e0e1b5 | ||
|
|
e923d65d53 | ||
|
|
4ad2f0a212 |
|
|
@ -304,8 +304,8 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB
|
||||||
var output = new byte[input.Length];
|
var output = new byte[input.Length];
|
||||||
var prevBytes = (byte[])aes_iv.Clone();
|
var prevBytes = (byte[])aes_iv.Clone();
|
||||||
var span = MemoryMarshal.Cast<byte, long>(input);
|
var span = MemoryMarshal.Cast<byte, long>(input);
|
||||||
var sout = MemoryMarshal.Cast<byte, long>(output);
|
var sout = MemoryMarshal.Cast<byte, long>(output.AsSpan());
|
||||||
var prev = MemoryMarshal.Cast<byte, long>(prevBytes);
|
var prev = MemoryMarshal.Cast<byte, long>(prevBytes.AsSpan());
|
||||||
if (!encrypt) { (prev[2], prev[0]) = (prev[0], prev[2]); (prev[3], prev[1]) = (prev[1], prev[3]); }
|
if (!encrypt) { (prev[2], prev[0]) = (prev[0], prev[2]); (prev[3], prev[1]) = (prev[1], prev[3]); }
|
||||||
for (int i = 0, count = input.Length / 8; i < count;)
|
for (int i = 0, count = input.Length / 8; i < count;)
|
||||||
{
|
{
|
||||||
|
|
@ -556,7 +556,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB
|
||||||
{
|
{
|
||||||
count = count + 15 & ~15;
|
count = count + 15 & ~15;
|
||||||
var span = MemoryMarshal.Cast<byte, long>(buffer.AsSpan(offset, count));
|
var span = MemoryMarshal.Cast<byte, long>(buffer.AsSpan(offset, count));
|
||||||
var prev = MemoryMarshal.Cast<byte, long>(_prevBytes);
|
var prev = MemoryMarshal.Cast<byte, long>(_prevBytes.AsSpan());
|
||||||
for (offset = 0, count /= 8; offset < count;)
|
for (offset = 0, count /= 8; offset < count;)
|
||||||
{
|
{
|
||||||
prev[0] ^= span[offset]; prev[1] ^= span[offset + 1];
|
prev[0] ^= span[offset]; prev[1] ^= span[offset + 1];
|
||||||
|
|
|
||||||
|
|
@ -109,15 +109,13 @@ namespace TL
|
||||||
public Int128 new_nonce_hash3;
|
public Int128 new_nonce_hash3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DestroyAuthKeyRes : uint
|
public abstract partial class DestroyAuthKeyRes : IObject { }
|
||||||
{
|
[TLDef(0xF660E1D4)] //destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes
|
||||||
///<summary>See <a href="https://corefork.telegram.org/constructor/destroy_auth_key_ok"/></summary>
|
public sealed partial class DestroyAuthKeyOk : DestroyAuthKeyRes { }
|
||||||
Ok = 0xF660E1D4,
|
[TLDef(0x0A9F2259)] //destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes
|
||||||
///<summary>See <a href="https://corefork.telegram.org/constructor/destroy_auth_key_none"/></summary>
|
public sealed partial class DestroyAuthKeyNone : DestroyAuthKeyRes { }
|
||||||
None = 0x0A9F2259,
|
[TLDef(0xEA109B13)] //destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes
|
||||||
///<summary>See <a href="https://corefork.telegram.org/constructor/destroy_auth_key_fail"/></summary>
|
public sealed partial class DestroyAuthKeyFail : DestroyAuthKeyRes { }
|
||||||
Fail = 0xEA109B13,
|
|
||||||
}
|
|
||||||
|
|
||||||
[TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck
|
[TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck
|
||||||
public sealed partial class MsgsAck : IObject
|
public sealed partial class MsgsAck : IObject
|
||||||
|
|
@ -327,12 +325,12 @@ namespace TL
|
||||||
});
|
});
|
||||||
|
|
||||||
public static Task<DestroyAuthKeyRes> DestroyAuthKey(this Client client)
|
public static Task<DestroyAuthKeyRes> DestroyAuthKey(this Client client)
|
||||||
=> client.InvokeBare(new DestroyAuthKey
|
=> client.Invoke(new DestroyAuthKey
|
||||||
{
|
{
|
||||||
});
|
});
|
||||||
|
|
||||||
public static Task<RpcDropAnswer> RpcDropAnswer(this Client client, long req_msg_id)
|
public static Task<RpcDropAnswer> RpcDropAnswer(this Client client, long req_msg_id)
|
||||||
=> client.InvokeBare(new Methods.RpcDropAnswer
|
=> client.Invoke(new Methods.RpcDropAnswer
|
||||||
{
|
{
|
||||||
req_msg_id = req_msg_id,
|
req_msg_id = req_msg_id,
|
||||||
});
|
});
|
||||||
|
|
@ -357,7 +355,7 @@ namespace TL
|
||||||
});
|
});
|
||||||
|
|
||||||
public static Task<DestroySessionRes> DestroySession(this Client client, long session_id)
|
public static Task<DestroySessionRes> DestroySession(this Client client, long session_id)
|
||||||
=> client.InvokeBare(new DestroySession
|
=> client.Invoke(new DestroySession
|
||||||
{
|
{
|
||||||
session_id = session_id,
|
session_id = session_id,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,9 @@ namespace TL
|
||||||
[0x3BCBF734] = typeof(DhGenOk),
|
[0x3BCBF734] = typeof(DhGenOk),
|
||||||
[0x46DC1FB9] = typeof(DhGenRetry),
|
[0x46DC1FB9] = typeof(DhGenRetry),
|
||||||
[0xA69DAE02] = typeof(DhGenFail),
|
[0xA69DAE02] = typeof(DhGenFail),
|
||||||
[0x7ABE77EC] = typeof(Methods.Ping),
|
[0xF660E1D4] = typeof(DestroyAuthKeyOk),
|
||||||
|
[0x0A9F2259] = typeof(DestroyAuthKeyNone),
|
||||||
|
[0xEA109B13] = typeof(DestroyAuthKeyFail),
|
||||||
[0x62D6B459] = typeof(MsgsAck),
|
[0x62D6B459] = typeof(MsgsAck),
|
||||||
[0xA7EFF811] = typeof(BadMsgNotification),
|
[0xA7EFF811] = typeof(BadMsgNotification),
|
||||||
[0xEDAB447B] = typeof(BadServerSalt),
|
[0xEDAB447B] = typeof(BadServerSalt),
|
||||||
|
|
@ -66,6 +68,7 @@ namespace TL
|
||||||
[0x37982646] = typeof(IpPortSecret),
|
[0x37982646] = typeof(IpPortSecret),
|
||||||
[0x4679B65F] = typeof(AccessPointRule),
|
[0x4679B65F] = typeof(AccessPointRule),
|
||||||
[0x5A592A6C] = typeof(Help_ConfigSimple),
|
[0x5A592A6C] = typeof(Help_ConfigSimple),
|
||||||
|
[0x7ABE77EC] = typeof(Methods.Ping),
|
||||||
// from TL.SchemaExtensions:
|
// from TL.SchemaExtensions:
|
||||||
[0x3FEDD339] = typeof(True),
|
[0x3FEDD339] = typeof(True),
|
||||||
[0xC4B9F9BB] = typeof(Error),
|
[0xC4B9F9BB] = typeof(Error),
|
||||||
|
|
|
||||||
11
src/TL.cs
11
src/TL.cs
|
|
@ -325,13 +325,14 @@ namespace TL
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void WriteTLStamp(this BinaryWriter writer, DateTime datetime)
|
internal static void WriteTLStamp(this BinaryWriter writer, DateTime datetime)
|
||||||
=> writer.Write(datetime == DateTime.MaxValue ? int.MaxValue : (int)(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L));
|
=> writer.Write((int)Math.Min(Math.Max(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L, 0), int.MaxValue));
|
||||||
|
|
||||||
internal static DateTime ReadTLStamp(this BinaryReader reader)
|
internal static DateTime ReadTLStamp(this BinaryReader reader) => reader.ReadInt32() switch
|
||||||
{
|
{
|
||||||
int unixstamp = reader.ReadInt32();
|
<= 0 => default,
|
||||||
return unixstamp == int.MaxValue ? DateTime.MaxValue : new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc);
|
int.MaxValue => DateTime.MaxValue,
|
||||||
}
|
int unixstamp => new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc)
|
||||||
|
};
|
||||||
|
|
||||||
internal static void WriteTLString(this BinaryWriter writer, string str)
|
internal static void WriteTLString(this BinaryWriter writer, string str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue