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

75 lines
2 KiB
C#
Raw Normal View History

2016-09-24 15:38:26 +02:00
using System.IO;
namespace TeleSharp.TL.Account
{
[TLObject(-2037289493)]
2016-09-24 15:38:26 +02:00
public class TLPasswordInputSettings : TLObject
{
public override int Constructor
{
get
{
return -2037289493;
}
}
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
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
}
2016-09-24 15:38:26 +02:00
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
if ((flags & 1) != 0)
new_salt = BytesUtil.Deserialize(br);
else
new_salt = null;
2016-09-24 15:38:26 +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
if ((flags & 1) != 0)
hint = StringUtil.Deserialize(br);
else
hint = null;
2016-09-24 15:38:26 +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)
{
bw.Write(Constructor);
2016-09-24 15:38:26 +02:00
ComputeFlags();
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
}
}
}