TLSharp/TLSharp.Core/Requests/ImportByUserName.cs

36 lines
915 B
C#
Raw Normal View History

using System;
using System.IO;
using TLSharp.Core.MTProto;
namespace TLSharp.Core.Requests
{
2016-04-18 12:50:57 +02:00
public class ImportByUserName : MTProtoRequest
{
private readonly string _userName;
public int id { get; private set; }
public ImportByUserName(string userName)
{
_userName = userName;
}
2016-04-18 12:50:57 +02:00
public override void OnSend(BinaryWriter writer)
{
writer.Write(0xBF0131C);
Serializers.String.write(writer, _userName);
}
2016-04-18 12:50:57 +02:00
public override void OnResponse(BinaryReader reader)
{
var code = reader.ReadUInt32();
id = reader.ReadInt32();
}
2016-04-18 12:50:57 +02:00
public override void OnException(Exception exception)
{
throw new NotImplementedException();
}
2016-04-18 12:50:57 +02:00
public override bool Confirmed => true;
public override bool Responded { get; }
}
}