aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Dlna/Eventing/EventSubscription.cs
blob: bd4cbdd55dc2b4848247ac639f22bc51a5568789 (plain)
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
using System;

namespace MediaBrowser.Dlna.Eventing
{
    public class EventSubscription
    {
        public string Id { get; set; }
        public string CallbackUrl { get; set; }
        public string NotificationType { get; set; }

        public DateTime SubscriptionTime { get; set; }
        public int TimeoutSeconds { get; set; }

        public long TriggerCount { get; set; }

        public void IncrementTriggerCount()
        {
            if (TriggerCount == long.MaxValue)
            {
                TriggerCount = 0;
            }

            TriggerCount++;
        }

        public bool IsExpired
        {
            get
            {
                return SubscriptionTime.AddSeconds(TimeoutSeconds) >= DateTime.UtcNow;
            }
        }
    }
}