2015-09-28 04:01:17 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using TLSharp.Core.MTProto;
|
2016-09-22 15:31:59 +02:00
|
|
|
|
using TeleSharp.TL;
|
2015-09-28 04:01:17 +02:00
|
|
|
|
namespace TLSharp.Core.Requests
|
|
|
|
|
|
{
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public class AuthSendCodeRequest : MTProtoRequest
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public bool _phoneRegistered;
|
|
|
|
|
|
public string _phoneCodeHash;
|
2016-09-22 15:31:59 +02:00
|
|
|
|
public SendCodeArgs args=new SendCodeArgs();
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode)
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
|
|
|
|
|
|
args.phone_number = phoneNumber;
|
|
|
|
|
|
args.api_id = apiId;
|
|
|
|
|
|
args.api_hash = apiHash;
|
|
|
|
|
|
args.allow_flashcall = false;
|
|
|
|
|
|
args.current_number = true;
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override void OnSend(BinaryWriter writer)
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
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);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override void OnResponse(BinaryReader reader)
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
|
|
|
|
|
|
var s = Deserializer.Deserialize(typeof(SentCode), reader);
|
|
|
|
|
|
_phoneRegistered = ((SentCode)s).phone_registered;
|
|
|
|
|
|
_phoneCodeHash = ((SentCode)s).phone_code_hash;
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override void OnException(Exception exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override bool Confirmed => true;
|
|
|
|
|
|
public override bool Responded { get; }
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
}
|