diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-15 16:21:13 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-15 16:21:13 +0200 |
| commit | dcdee2479e0dc709835e97853bb9db0349210336 (patch) | |
| tree | ceafc1d3679931f0798236434e284d9a7ed644de /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService | |
| parent | b0909a133eaba5223ca397c8186ba6b96fdaa647 (diff) | |
| download | Tango-dcdee2479e0dc709835e97853bb9db0349210336.tar.gz Tango-dcdee2479e0dc709835e97853bb9db0349210336.zip | |
Machine Studio v3.5.70 Stable.
Added stable/beta release modes.
Handle corrupted log file names.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs | 39 |
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(); |
