This repository was archived by the owner on Dec 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 372
Expand file tree
/
Copy pathAuthSendCodeRequest.cs
More file actions
48 lines (41 loc) · 1.43 KB
/
AuthSendCodeRequest.cs
File metadata and controls
48 lines (41 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.IO;
using TLSharp.Core.MTProto;
using TeleSharp.TL;
namespace TLSharp.Core.Requests
{
public class AuthSendCodeRequest : MTProtoRequest
{
public bool _phoneRegistered;
public string _phoneCodeHash;
public SendCodeArgs args=new SendCodeArgs();
public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode)
{
args.phone_number = phoneNumber;
args.api_id = apiId;
args.api_hash = apiHash;
args.allow_flashcall = false;
args.current_number = true;
}
public override void OnSend(BinaryWriter writer)
{
writer.Write(0x86AEF0EC);
writer.Write(0);
Serializers.String.write(writer, args.phone_number);
writer.Write(args.api_id.Value);
Serializers.String.write(writer, args.api_hash);
}
public override void OnResponse(BinaryReader reader)
{
var s = Deserializer.Deserialize(typeof(SentCode), reader);
_phoneRegistered = ((SentCode)s).phone_registered;
_phoneCodeHash = ((SentCode)s).phone_code_hash;
}
public override void OnException(Exception exception)
{
throw new NotImplementedException();
}
public override bool Confirmed => true;
public override bool Responded { get; }
}
}