-
Notifications
You must be signed in to change notification settings - Fork 0
/
TLMethod.cs
45 lines (39 loc) · 1.14 KB
/
TLMethod.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TLSchema
{
public abstract class TLMethod : TLObject
{
public abstract void DeserializeResponse(BinaryReader stream);
#region MTPROTO
public long MessageId { get; set; }
public int Sequence { get; set; }
public bool Dirty { get; set; }
public bool Sended { get; private set; }
public DateTime SendTime { get; private set; }
public bool ConfirmReceived { get; set; }
public virtual bool Confirmed { get; } = true;
public virtual bool Responded { get; } = false;
public virtual void OnSendSuccess()
{
SendTime = DateTime.Now;
Sended = true;
}
public virtual void OnConfirm()
{
ConfirmReceived = true;
}
public bool NeedResend
{
get
{
return Dirty || (Confirmed && !ConfirmReceived && DateTime.Now - SendTime > TimeSpan.FromSeconds(3));
}
}
#endregion
}
}