Replaced Merkle hash with MD5 for change checking
[pithos-ms-client] / trunk / Pithos.Core / Agents / Notifier.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace Pithos.Core
8 {
9     public class Notifier:IDisposable
10     {
11         private readonly IStatusNotification _statusNotification;
12
13         private readonly Notification _endNotification;
14
15         public Notifier(IStatusNotification statusNotification,string startMessage,string endMessage)
16             :this(statusNotification,new Notification{Message=startMessage},new Notification{Message=endMessage} )
17         {
18             
19         }
20
21         public Notifier(IStatusNotification statusNotification,Notification startNotification,Notification endNotification)
22         {
23             _statusNotification = statusNotification;
24             _endNotification = endNotification;
25             _statusNotification.Notify(startNotification);
26         }
27
28
29         public void Dispose()
30         {
31             Dispose(true);
32             GC.SuppressFinalize(this);
33         }
34
35         ~Notifier()
36         {
37             Dispose(false);
38         }
39
40         protected virtual void Dispose(bool disposing)
41         {
42             if (disposing)
43             {
44                 _statusNotification.Notify(_endNotification);        
45             }
46         }
47     }
48 }