2012-01-25 04:09:49 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using DeskMetrics;
|
|
|
|
|
using Ninject;
|
|
|
|
|
using NzbDrone.Common;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
|
{
|
|
|
|
|
public class AnalyticsProvider
|
|
|
|
|
{
|
|
|
|
|
private readonly IDeskMetricsClient _deskMetricsClient;
|
|
|
|
|
public const string DESKMETRICS_ID = "4ea8d347a14ad71442000002";
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
public AnalyticsProvider(IDeskMetricsClient deskMetricsClient)
|
|
|
|
|
{
|
|
|
|
|
_deskMetricsClient = deskMetricsClient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AnalyticsProvider()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Checkpoint()
|
|
|
|
|
{
|
|
|
|
|
if (EnviromentProvider.IsNewInstall)
|
|
|
|
|
{
|
|
|
|
|
_deskMetricsClient.RegisterInstall();
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-26 02:29:55 +01:00
|
|
|
|
if (_deskMetricsClient.Started)
|
|
|
|
|
{
|
|
|
|
|
_deskMetricsClient.Stop();
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-25 04:09:49 +01:00
|
|
|
|
_deskMetricsClient.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|