main
1using momoney.service.infrastructure.updating;
2
3namespace MoMoney.Service.Infrastructure.Updating
4{
5 public class WhatIsTheAvailableVersion : IWhatIsTheAvailableVersion
6 {
7 readonly IDeployment deployment;
8
9 public WhatIsTheAvailableVersion(IDeployment deployment)
10 {
11 this.deployment = deployment;
12 }
13
14 public ApplicationVersion fetch()
15 {
16 var update = deployment.CheckForDetailedUpdate();
17 if (null == update)
18 {
19 return new ApplicationVersion {updates_available = false,};
20 }
21 return new ApplicationVersion
22 {
23 activation_url = deployment.ActivationUri,
24 current = deployment.CurrentVersion,
25 data_directory = deployment.DataDirectory,
26 updates_available = update.IsUpdateRequired || update.UpdateAvailable,
27 last_checked_for_updates = deployment.TimeOfLastUpdateCheck,
28 application_name = deployment.UpdatedApplicationFullName,
29 deployment_url = deployment.UpdateLocation,
30 available_version = update.AvailableVersion,
31 size_of_update_in_bytes = update.UpdateSizeBytes,
32 };
33 }
34 }
35}