diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-06 16:09:35 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-06 16:09:35 -0400 |
| commit | 234dba2d9a676ed99b972186160f8993e7293208 (patch) | |
| tree | 995e09e1134f42a843f70538efe01ee166927081 /MediaBrowser.Common.Implementations/Security | |
| parent | eb1ade477d09124e0e0e2ce35009302e6818c5c9 (diff) | |
move usage reporter to server project
Diffstat (limited to 'MediaBrowser.Common.Implementations/Security')
| -rw-r--r-- | MediaBrowser.Common.Implementations/Security/UsageReporter.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/MediaBrowser.Common.Implementations/Security/UsageReporter.cs b/MediaBrowser.Common.Implementations/Security/UsageReporter.cs deleted file mode 100644 index eedadd6b3a..0000000000 --- a/MediaBrowser.Common.Implementations/Security/UsageReporter.cs +++ /dev/null @@ -1,73 +0,0 @@ -using MediaBrowser.Common.Net; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Common.Implementations.Security -{ - public class UsageReporter - { - private readonly IApplicationHost _applicationHost; - private readonly INetworkManager _networkManager; - private readonly IHttpClient _httpClient; - - public UsageReporter(IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient) - { - _applicationHost = applicationHost; - _networkManager = networkManager; - _httpClient = httpClient; - } - - public Task ReportServerUsage(CancellationToken cancellationToken) - { - cancellationToken.ThrowIfCancellationRequested(); - - var mac = _networkManager.GetMacAddress(); - - var data = new Dictionary<string, string> - { - { "feature", _applicationHost.Name }, - { "mac", mac }, - { "serverid", _applicationHost.SystemId }, - { "deviceid", _applicationHost.SystemId }, - { "ver", _applicationHost.ApplicationVersion.ToString() }, - { "platform", Environment.OSVersion.VersionString }, - { "isservice", _applicationHost.IsRunningAsService.ToString().ToLower()} - }; - - return _httpClient.Post(Constants.Constants.MbAdminUrl + "service/registration/ping", data, cancellationToken); - } - - public Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken) - { - if (string.IsNullOrWhiteSpace(app.DeviceId)) - { - throw new ArgumentException("Client info must have a device Id"); - } - - cancellationToken.ThrowIfCancellationRequested(); - - var data = new Dictionary<string, string> - { - { "feature", app.AppName ?? "Unknown App" }, - { "serverid", _applicationHost.SystemId }, - { "deviceid", app.DeviceId }, - { "mac", app.DeviceId }, - { "ver", app.AppVersion ?? "Unknown" }, - { "platform", app.DeviceName }, - }; - - return _httpClient.Post(Constants.Constants.MbAdminUrl + "service/registration/ping", data, cancellationToken); - } - } - - public class ClientInfo - { - public string AppName { get; set; } - public string AppVersion { get; set; } - public string DeviceName { get; set; } - public string DeviceId { get; set; } - } -} |
