From ad94224fb5ffe2c070e21933d087bceb839f4517 Mon Sep 17 00:00:00 2001 From: eaba Date: Mon, 16 May 2016 09:25:07 +0100 Subject: [PATCH] Add files via upload --- TLSharp.Core/Requests/AuthSignUpRequest.cs | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 TLSharp.Core/Requests/AuthSignUpRequest.cs diff --git a/TLSharp.Core/Requests/AuthSignUpRequest.cs b/TLSharp.Core/Requests/AuthSignUpRequest.cs new file mode 100644 index 0000000..1ce143e --- /dev/null +++ b/TLSharp.Core/Requests/AuthSignUpRequest.cs @@ -0,0 +1,52 @@ +using System; +using System.IO; +using TLSharp.Core.MTProto; + +namespace TLSharp.Core.Requests +{ + public class AuthSignUpRequest : MTProtoRequest + { + private readonly string _phoneNumber; + private readonly string _phoneCodeHash; + private readonly string _code; + private readonly string _firstName; + private readonly string _lastName; + + public User user; + public int SessionExpires; + + public AuthSignUpRequest(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName) + { + _phoneNumber = phoneNumber; + _phoneCodeHash = phoneCodeHash; + _code = code; + _firstName = firstName; + _lastName = lastName; + } + + public override void OnSend(BinaryWriter writer) + { + writer.Write(0x1b067634); + Serializers.String.write(writer, _phoneNumber); + Serializers.String.write(writer, _phoneCodeHash); + Serializers.String.write(writer, _code); + Serializers.String.write(writer, _firstName); + Serializers.String.write(writer, _lastName); + } + + public override void OnResponse(BinaryReader reader) + { + var dataCode = reader.ReadUInt32(); //0xf6b673a4 + var expires = reader.ReadInt32(); + user = TL.Parse(reader); + } + + public override void OnException(Exception exception) + { + throw new NotImplementedException(); + } + + public override bool Confirmed => true; + public override bool Responded { get; } + } +}