TLSharp/TeleSharp.TL/TL/Account/TLPasswordInputSettings.cs

65 lines
1.9 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
2016-09-24 15:38:26 +02:00
namespace TeleSharp.TL.Account
{
2017-04-13 08:38:01 +02:00
[TLObject(-2037289493)]
2016-09-24 15:38:26 +02:00
public class TLPasswordInputSettings : TLObject
{
2017-04-13 08:38:01 +02:00
public override int Constructor => -2037289493;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public int flags { get; set; }
public byte[] new_salt { get; set; }
public byte[] new_password_hash { get; set; }
public string hint { get; set; }
public string email { get; set; }
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public void ComputeFlags()
{
flags = 0;
flags = new_salt != null ? flags | 1 : flags & ~1;
flags = new_password_hash != null ? flags | 1 : flags & ~1;
flags = hint != null ? flags | 1 : flags & ~1;
flags = email != null ? flags | 2 : flags & ~2;
}
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
if ((flags & 1) != 0)
new_salt = BytesUtil.Deserialize(br);
else
new_salt = null;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
if ((flags & 1) != 0)
new_password_hash = BytesUtil.Deserialize(br);
else
new_password_hash = null;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
if ((flags & 1) != 0)
hint = StringUtil.Deserialize(br);
else
hint = null;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
if ((flags & 2) != 0)
email = StringUtil.Deserialize(br);
else
email = 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);
if ((flags & 1) != 0)
BytesUtil.Serialize(new_salt, bw);
if ((flags & 1) != 0)
BytesUtil.Serialize(new_password_hash, bw);
if ((flags & 1) != 0)
StringUtil.Serialize(hint, bw);
if ((flags & 2) != 0)
StringUtil.Serialize(email, bw);
2016-09-24 15:38:26 +02:00
}
}
2017-04-13 08:38:01 +02:00
}