aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-11-25 10:44:37 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-11-25 10:44:37 +0200
commitbeff6af103bb0ae9b9147a907c6567bdb33abd00 (patch)
tree375eefd654c25f3b68c0cf5b3612df844a140d8e /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
parent57f20269fbb4c591aa73c9f5e50118310cc4892e (diff)
parentdff24e56a8906b8c9b355cf407f25f4b793beafe (diff)
downloadTango-beff6af103bb0ae9b9147a907c6567bdb33abd00.tar.gz
Tango-beff6af103bb0ae9b9147a907c6567bdb33abd00.zip
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
index 7dff2f203..2453fd361 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
@@ -33,6 +33,8 @@ namespace Tango.MachineStudio.UpdateService
public bool ForcedUpdate { get; set; }
public String FilePath { get; set; }
+
+ public bool IsStable { get; set; }
}
private static List<PendingUpload> _pendingUploads;
@@ -64,15 +66,28 @@ namespace Tango.MachineStudio.UpdateService
if (user != null && user.HasPermission(Permissions.RunMachineStudio) || (request.Email == "ForceUpdate"))
{
- var latestVersion = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
+ var versions = db.MachineStudioVersions.ToList();
+
+ MachineStudioVersion latestVersion = null;
+
+ if (request.AcceptBetaRelease)
+ {
+ latestVersion = versions.OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
+ }
+ else
+ {
+ latestVersion = versions.Where(x => x.Stable).OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
+ }
+
Version currentVersion = Version.Parse(request.Version);
- bool isForcedUpdate = db.MachineStudioVersions.ToList().Exists(x => x.ForceUpdate && Version.Parse(x.Version) > currentVersion);
+ bool isForcedUpdate = versions.Exists(x => x.ForceUpdate && Version.Parse(x.Version) > currentVersion);
+
+ String comments = String.Join(Environment.NewLine, versions.OrderBy(x => Version.Parse(x.Version)).Where(x => Version.Parse(x.Version) > currentVersion).Select(x => x.Comments));
if (latestVersion != null && Version.Parse(latestVersion.Version) > currentVersion)
{
response.IsUpdateAvailable = true;
-
response.FtpHost = ConfigurationManager.AppSettings["FtpHost"].ToString();
response.UserName = ConfigurationManager.AppSettings["UserName"].ToString();
response.Password = ConfigurationManager.AppSettings["Password"].ToString();
@@ -80,6 +95,7 @@ namespace Tango.MachineStudio.UpdateService
response.Version = latestVersion.Version;
response.Comments = latestVersion.Comments;
response.ForcedUpdate = isForcedUpdate;
+ response.IsStable = latestVersion.Stable;
}
}
else
@@ -141,6 +157,7 @@ namespace Tango.MachineStudio.UpdateService
Token = response.Token,
Version = request.Version,
FilePath = response.FilePath,
+ IsStable = request.IsStable,
});
}
else
@@ -184,6 +201,7 @@ namespace Tango.MachineStudio.UpdateService
UserGuid = upload.UserGuid,
Version = upload.Version,
ForceUpdate = upload.ForcedUpdate,
+ Stable = upload.IsStable,
});
db.SaveChanges();