From b5472c6cd7a6cce19c45e0b9e361c96f26502fa3 Mon Sep 17 00:00:00 2001 From: Afshin Arani Date: Thu, 22 Sep 2016 17:09:56 +0330 Subject: [PATCH] Add DownloadFileRequest Class --- TLSharp.Core/Requests/DownloadFileRequest.cs | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 TLSharp.Core/Requests/DownloadFileRequest.cs diff --git a/TLSharp.Core/Requests/DownloadFileRequest.cs b/TLSharp.Core/Requests/DownloadFileRequest.cs new file mode 100644 index 0000000..4574a9b --- /dev/null +++ b/TLSharp.Core/Requests/DownloadFileRequest.cs @@ -0,0 +1,36 @@ +using System; +using System.IO; +using TeleSharp.TL; +namespace TLSharp.Core.Requests +{ + public class DownloadFileRequest : MTProtoRequest + { + private GetFileArgs args = new GetFileArgs(); + public TeleSharp.TL.File file; + + public DownloadFileRequest(InputFileLocation loc,int offset=0,int limit=0) + { + args.location = loc; + args.offset = offset; + args.limit = limit; + } + + public override void OnSend(BinaryWriter writer) + { + Serializer.Serialize(args, typeof(InputFileLocation), writer); + } + + public override void OnResponse(BinaryReader reader) + { + file = (TeleSharp.TL.File)Deserializer.Deserialize(typeof(TeleSharp.TL.File), reader); + } + + public override void OnException(Exception exception) + { + throw new NotImplementedException(); + } + + public override bool Confirmed => true; + public override bool Responded { get; } + } +}