From dcdee2479e0dc709835e97853bb9db0349210336 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 15 Nov 2018 16:21:13 +0200 Subject: Machine Studio v3.5.70 Stable. Added stable/beta release modes. Handle corrupted log file names. --- .../Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1532 bytes .../Parsing/ApplicationLogFileParser.cs | 13 +- .../Parsing/EmbeddedLogFileParser.cs | 13 +- .../MachineStudioSettings.cs | 5 + .../Update/CheckForUpdatesRequest.cs | 3 + .../Update/CheckForUpdatesResponse.cs | 3 + .../Update/UploadVersionRequest.cs | 3 + .../Tango.MachineStudio.Publisher/MainWindow.xaml | 5 +- .../Tango.MachineStudio.Publisher/MainWindowVM.cs | 10 ++ .../Properties/AssemblyInfo.cs | 2 +- .../ViewModels/MainViewVM.cs | 1 + .../ViewModels/UpdateViewVM.cs | 5 + .../MachineStudioUpdateService.svc.cs | 41 ++++-- .../Tango.BL/Entities/MachineStudioVersion.cs | 30 +++++ .../Tango.DAL.Remote/DB/MACHINE_STUDIO_VERSIONS.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 150 ++++++++++----------- 17 files changed, 194 insertions(+), 94 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index 63a00b856..7875a2732 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs index 4717196df..d3b33c436 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs @@ -22,9 +22,16 @@ namespace Tango.MachineStudio.Logging.Parsing foreach (var file in Directory.GetFiles(FileLogger.DefaultLogsFolder, "*.log").Where(x => Path.GetFileName(x).StartsWith("Tango.MachineStudio.UI") && x != logger.LogFile)) { - String dateString = Path.GetFileNameWithoutExtension(file).Replace("Tango.MachineStudio.UI-", ""); - DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); - logFiles.Add(new LogFile() { DateTime = date, File = file }); + try + { + String dateString = Path.GetFileNameWithoutExtension(file).Replace("Tango.MachineStudio.UI-", ""); + DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); + logFiles.Add(new LogFile() { DateTime = date, File = file }); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, $"Could not load application log file {Path.GetFileName(file)}"); + } } return logFiles; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs index ca68334bf..50c9d7532 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs @@ -26,9 +26,16 @@ namespace Tango.MachineStudio.Logging.Parsing { foreach (var file in Directory.GetFiles(MachineOperator.EmbeddedLogsFolder, "*.log").Where(x => x != logFile)) { - String dateString = Path.GetFileNameWithoutExtension(file).Replace(MachineOperator.EmbeddedLogsTag + "-", ""); - DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); - logFiles.Add(new LogFile() { DateTime = date, File = file }); + try + { + String dateString = Path.GetFileNameWithoutExtension(file).Replace(MachineOperator.EmbeddedLogsTag + "-", ""); + DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); + logFiles.Add(new LogFile() { DateTime = date, File = file }); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, $"Could not load embedded log file {Path.GetFileName(file)}"); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 06d5d44c5..67e052ecc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -43,6 +43,11 @@ namespace Tango.MachineStudio.Common /// public String UpdateServiceAddress { get; set; } + /// + /// Gets or sets the allow beta release. + /// + public bool AcceptBetaRelease { get; set; } + /// /// Gets or sets the logging categories. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs index f76e714a2..0047e311b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs @@ -18,5 +18,8 @@ namespace Tango.MachineStudio.Common.Update [DataMember] public String Version { get; set; } + + [DataMember] + public bool AcceptBetaRelease { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesResponse.cs index 8ae921156..f34f12d8f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesResponse.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesResponse.cs @@ -13,6 +13,9 @@ namespace Tango.MachineStudio.Common.Update [DataMember] public bool IsUpdateAvailable { get; set; } + [DataMember] + public bool IsStable { get; set; } + [DataMember] public String Version { get; set; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadVersionRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadVersionRequest.cs index 18f29eda2..83739f615 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadVersionRequest.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadVersionRequest.cs @@ -24,5 +24,8 @@ namespace Tango.MachineStudio.Common.Update [DataMember] public bool ForcedUpdate { get; set; } + + [DataMember] + public bool IsStable { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml index 404faf4ab..28f0c1e80 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindow.xaml @@ -49,7 +49,10 @@ Comments - Forced Update + + Forced Update + Stable Release + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs index 702343c72..ffeefb820 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs @@ -61,6 +61,15 @@ namespace Tango.MachineStudio.Publisher set { _forcesUpdate = value; RaisePropertyChangedAuto(); } } + private bool _isStable; + + public bool IsStable + { + get { return _isStable; } + set { _isStable = value; RaisePropertyChangedAuto(); } + } + + private String _currentVersion; public String CurrentVersion @@ -154,6 +163,7 @@ namespace Tango.MachineStudio.Publisher Version = CurrentVersion.ToString(), Comments = Comments, ForcedUpdate = ForcedUpdate, + IsStable = IsStable, }); tempFile = Path.Combine(Path.GetTempPath(), response.FileName); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 1caa12577..1591de4ac 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.69.18305")] +[assembly: AssemblyVersion("3.5.70.18305")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 31e297cd1..58dfc17c2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -367,6 +367,7 @@ namespace Tango.MachineStudio.UI.ViewModels Email = _authenticationProvider.CurrentUser.Email, Password = _authenticationProvider.CurrentUser.Password, Version = _applicationManager.Version.ToString(), + AcceptBetaRelease = _settings.AcceptBetaRelease, }); IsUpdateAvailable = response.IsUpdateAvailable; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index 55f585626..a9624da2d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -22,6 +22,8 @@ using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Common.Update; using Tango.SharedUI; using Tango.MachineStudio.UI.Messages; +using Tango.Settings; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.ViewModels { @@ -181,6 +183,8 @@ namespace Tango.MachineStudio.UI.ViewModels { Status = UpdateStatus.CheckingForUpdate; + var settings = SettingsManager.Default.GetOrCreate(); + ChannelFactory service = null; Task.Factory.StartNew(() => @@ -197,6 +201,7 @@ namespace Tango.MachineStudio.UI.ViewModels Email = _authentication.CurrentUser.Email, Password = _authentication.CurrentUser.Password, Version = _application.Version.ToString(), + AcceptBetaRelease = settings.AcceptBetaRelease, }); if (response.IsUpdateAvailable) 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 _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); - if (latestVersion != null && Version.Parse(latestVersion.Version) > currentVersion) + bool stable_condition = true; + + if (!request.AcceptBetaRelease && !latestVersion.Stable) { - response.IsUpdateAvailable = true; + stable_condition = false; + } - 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; + 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) + { + 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.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(); diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersion.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersion.cs index 75838118c..3167b3ccf 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersion.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersion.cs @@ -33,6 +33,8 @@ namespace Tango.BL.Entities public event EventHandler ForceUpdateChanged; + public event EventHandler StableChanged; + public event EventHandler UserChanged; protected String _version; @@ -173,6 +175,34 @@ namespace Tango.BL.Entities } } + protected Boolean _stable; + + /// + /// Gets or sets the machinestudioversion stable. + /// + + [Column("STABLE")] + + public Boolean Stable + { + get + { + return _stable; + } + + set + { + if (_stable != value) + { + _stable = value; + + StableChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(Stable)); + } + } + } + protected User _user; /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_STUDIO_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_STUDIO_VERSIONS.cs index 622c0a0df..eed787485 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_STUDIO_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_STUDIO_VERSIONS.cs @@ -22,6 +22,7 @@ namespace Tango.DAL.Remote.DB public string COMMENTS { get; set; } public string USER_GUID { get; set; } public bool FORCE_UPDATE { get; set; } + public bool STABLE { get; set; } public virtual USER USER { get; set; } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 099d780c3..46591fb34 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -677,6 +677,7 @@ + @@ -3761,6 +3762,7 @@ + @@ -6024,6 +6026,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 645db3497..8667820a2 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,81 +5,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1