mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Add DownloadFileRequest Class
This commit is contained in:
parent
56b2092b9b
commit
b5472c6cd7
36
TLSharp.Core/Requests/DownloadFileRequest.cs
Normal file
36
TLSharp.Core/Requests/DownloadFileRequest.cs
Normal file
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue