aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs39
1 files changed, 29 insertions, 10 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..ce9f7bd93 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,22 +66,37 @@ 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();
+
+ var latestVersion = versions.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);
+
+ bool stable_condition = true;
+
+ if (!request.AcceptBetaRelease && !latestVersion.Stable)
+ {
+ stable_condition = false;
+ }
+
+ 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;
+ if (stable_condition)
+ {
+ response.IsUpdateAvailable = true;
- response.FtpHost = ConfigurationManager.AppSettings["FtpHost"].ToString();
- response.UserName = ConfigurationManager.AppSettings["UserName"].ToString();
- response.Password = ConfigurationManager.AppSettings["Password"].ToString();
- response.FilePath = latestVersion.FtpFilePath;
- response.Version = latestVersion.Version;
- response.Comments = latestVersion.Comments;
- response.ForcedUpdate = isForcedUpdate;
+ response.FtpHost = ConfigurationManager.AppSettings["FtpHost"].ToString();
+ response.UserName = ConfigurationManager.AppSettings["UserName"].ToString();
+ response.Password = ConfigurationManager.AppSettings["Password"].ToString();
+ response.FilePath = latestVersion.FtpFilePath;
+ response.Version = latestVersion.Version;
+ response.Comments = latestVersion.Comments;
+ response.ForcedUpdate = isForcedUpdate;
+ response.IsStable = latestVersion.Stable;
+ }
}
}
else
@@ -141,6 +158,7 @@ namespace Tango.MachineStudio.UpdateService
Token = response.Token,
Version = request.Version,
FilePath = response.FilePath,
+ IsStable = request.IsStable,
});
}
else
@@ -184,6 +202,7 @@ namespace Tango.MachineStudio.UpdateService
UserGuid = upload.UserGuid,
Version = upload.Version,
ForceUpdate = upload.ForcedUpdate,
+ Stable = upload.IsStable,
});
db.SaveChanges();