TLSharp/TeleSharp.TL/TL/Account/TLRequestSendChangePhoneCode.cs

52 lines
1.5 KiB
C#
Raw Normal View History

2016-09-24 15:38:26 +02:00
using System.IO;
2017-04-13 08:38:01 +02:00
using TeleSharp.TL.Auth;
2016-09-24 15:38:26 +02:00
namespace TeleSharp.TL.Account
{
2017-04-13 08:38:01 +02:00
[TLObject(149257707)]
2016-09-24 15:38:26 +02:00
public class TLRequestSendChangePhoneCode : TLMethod
{
2017-04-13 08:38:01 +02:00
public override int Constructor => 149257707;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public int flags { get; set; }
public bool allow_flashcall { get; set; }
public string phone_number { get; set; }
public bool? current_number { get; set; }
public TLSentCode Response { get; set; }
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public void ComputeFlags()
{
flags = 0;
flags = allow_flashcall ? flags | 1 : flags & ~1;
flags = current_number != null ? flags | 1 : flags & ~1;
}
2016-09-24 15:38:26 +02:00
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
2017-04-13 08:38:01 +02:00
allow_flashcall = (flags & 1) != 0;
phone_number = StringUtil.Deserialize(br);
if ((flags & 1) != 0)
current_number = BoolUtil.Deserialize(br);
else
current_number = null;
2016-09-24 15:38:26 +02:00
}
public override void SerializeBody(BinaryWriter bw)
{
2017-04-13 08:38:01 +02:00
bw.Write(Constructor);
2016-09-24 15:38:26 +02:00
ComputeFlags();
2017-04-13 08:38:01 +02:00
bw.Write(flags);
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
StringUtil.Serialize(phone_number, bw);
if ((flags & 1) != 0)
BoolUtil.Serialize(current_number.Value, bw);
2016-09-24 15:38:26 +02:00
}
2017-04-13 08:38:01 +02:00
public override void deserializeResponse(BinaryReader br)
{
Response = (TLSentCode) ObjectUtils.DeserializeObject(br);
}
2016-09-24 15:38:26 +02:00
}
2017-04-13 08:38:01 +02:00
}