diff --git a/src/Chem4Word.V3/Chem4WordV3.cs b/src/Chem4Word.V3/Chem4WordV3.cs index 5f521e4..52745d4 100644 --- a/src/Chem4Word.V3/Chem4WordV3.cs +++ b/src/Chem4Word.V3/Chem4WordV3.cs @@ -29,6 +29,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading; +using System.Timers; using System.Windows; using System.Windows.Forms; using System.Windows.Threading; @@ -85,6 +86,8 @@ public partial class Chem4WordV3 public LibraryOptions LibraryOptions; public TelemetryWriter Telemetry; + private System.Timers.Timer _timer; + public List Editors = new List(); public List Renderers = new List(); public List Searchers = new List(); @@ -332,6 +335,11 @@ private void PerformStartUpActions() try { + _timer = new System.Timers.Timer(1000); + _timer.Elapsed += OnTimerElapsed; + _timer.AutoReset = true; + _timer.Enabled = true; + SetButtonStates(ButtonState.NoDocument); LoadOptions(); @@ -421,6 +429,23 @@ private void PerformStartUpActions() } } + private void OnTimerElapsed(object sender, ElapsedEventArgs e) + { + if (Telemetry != null + && Helper != null + && !string.IsNullOrEmpty(Helper.IpAddress) + && !Helper.IpAddress.Equals("0.0.0.0") + && !Helper.IpAddress.Equals("0.0.0.0")) + { + RegistryHelper.SendSetupActions(); + RegistryHelper.SendUpdateActions(); + RegistryHelper.SendMsiActions(); + + _timer.Enabled = false; + _timer.Elapsed -= OnTimerElapsed; + } + } + public void LoadNamesFromLibrary() { var module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod()?.Name}()"; @@ -931,7 +956,7 @@ public IChem4WordRenderer GetRendererPlugIn(string name) } } } - + if (plugin == null) { Telemetry.Write(module, "Warning", $"Could not find renderer plug in {name}"); @@ -1633,6 +1658,8 @@ private void HandleRightClick(Word.Selection selection) Telemetry.Write(module, "Exception", ex.ToString()); } + ClearChemistryContextMenus(); + if (selectedWords.Count > 0) { AddChemistryMenuPopup(selectedWords); @@ -1711,7 +1738,8 @@ private void ClearChemistryContextMenus() var popupControl = (CommandBarPopup)contextMenu.FindControl( MsoControlType.msoControlPopup, Type.Missing, ContextMenuTag, true, true); - if (popupControl != null) + if (popupControl != null + && popupControl.Caption.Equals(ContextMenuText)) { popupControl.Delete(true); } @@ -1853,6 +1881,8 @@ private void OnDocumentChange() DisableContentControlEvents(); EnableContentControlEvents(); + ClearChemistryContextMenus(); + SelectChemistry(document.Application.Selection); EvaluateChemistryAllowed(); diff --git a/src/Chem4Word.V3/Data/Chem4Word-Versions.xml b/src/Chem4Word.V3/Data/Chem4Word-Versions.xml index 23d98f1..57f45ea 100644 --- a/src/Chem4Word.V3/Data/Chem4Word-Versions.xml +++ b/src/Chem4Word.V3/Data/Chem4Word-Versions.xml @@ -5,10 +5,9 @@ 3.2.20 Release 16 false - 31-Aug-2024 + 21-Aug-2024 - ... - ... + BugFix: 'System.NullReferenceException: Object reference not set to an instance of an object' sometimes seen after editing a structure to combine two molecules Please note any previous beta versions V3.2.4 and below will cease to allow insertion or editing of chemistry If you like our product, please consider buying us a coffee at https://www.buymeacoffee.com/chem4word Please download Chem4Word-Setup.exe via https://www.chem4word.co.uk/download/ if you encounter any difficulties updating @@ -24,9 +23,6 @@ UX: Prohibit import of binary files BugFix: User unable to hide Hydrogens in Renderer (seen in Word document) Security: Update NuGet packages (Microsoft Security Advisory CVE-2024-30105) - Please note any previous beta versions V3.2.4 and below will cease to allow insertion or editing of chemistry - If you like our product, please consider buying us a coffee at https://www.buymeacoffee.com/chem4word - Please download Chem4Word-Setup.exe via https://www.chem4word.co.uk/download/ if you encounter any difficulties updating diff --git a/src/Chem4Word.V3/Data/This-Version.xml b/src/Chem4Word.V3/Data/This-Version.xml index 532c5d9..d429393 100644 --- a/src/Chem4Word.V3/Data/This-Version.xml +++ b/src/Chem4Word.V3/Data/This-Version.xml @@ -2,5 +2,5 @@ 3.2.20 Release 16 false - 31-Aug-2024 + 21-Aug-2024 \ No newline at end of file diff --git a/src/Chem4Word.V3/Helpers/RegistryHelper.cs b/src/Chem4Word.V3/Helpers/RegistryHelper.cs index c2d32ce..8edcf90 100644 --- a/src/Chem4Word.V3/Helpers/RegistryHelper.cs +++ b/src/Chem4Word.V3/Helpers/RegistryHelper.cs @@ -85,6 +85,17 @@ public static void SendUpdateActions() } } + public static void SendMsiActions() + { + var module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; + + var registryKey = Registry.CurrentUser.OpenSubKey(Constants.Chem4WordMsiActionsRegistryKey, true); + if (registryKey != null) + { + SendValues(module, "Setup", registryKey); + } + } + public static void SendMessages() { var module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; @@ -103,7 +114,7 @@ public static void SendExceptions() var registryKey = Registry.CurrentUser.OpenSubKey(Constants.Chem4WordExceptionsRegistryKey, true); if (registryKey != null) { - SendValues(module, "Exceptions", registryKey); + SendValues(module, "Exception", registryKey); } } diff --git a/src/Chem4Word.V3/Properties/AssemblyInfo.cs b/src/Chem4Word.V3/Properties/AssemblyInfo.cs index 30cc22f..025abff 100644 --- a/src/Chem4Word.V3/Properties/AssemblyInfo.cs +++ b/src/Chem4Word.V3/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Chem4Word.V3/Ribbon/Chem4WordRibbon.cs b/src/Chem4Word.V3/Ribbon/Chem4WordRibbon.cs index b1b62c8..59d81c8 100644 --- a/src/Chem4Word.V3/Ribbon/Chem4WordRibbon.cs +++ b/src/Chem4Word.V3/Ribbon/Chem4WordRibbon.cs @@ -618,6 +618,7 @@ private void AfterButtonChecks(RibbonButton button) { RegistryHelper.SendSetupActions(); RegistryHelper.SendUpdateActions(); + RegistryHelper.SendMsiActions(); RegistryHelper.SendMessages(); RegistryHelper.SendExceptions(); } diff --git a/src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs index de813c2..074554e 100644 --- a/src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs +++ b/src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Chemistry/Chem4Word.Libraries/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.Libraries/Properties/AssemblyInfo.cs index a2afe9f..5ff18dd 100644 --- a/src/Chemistry/Chem4Word.Libraries/Properties/AssemblyInfo.cs +++ b/src/Chemistry/Chem4Word.Libraries/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs index b605b04..7adb599 100644 --- a/src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs +++ b/src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Chemistry/Chem4Word.WebServices/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.WebServices/Properties/AssemblyInfo.cs index fb001e5..2e18fd1 100644 --- a/src/Chemistry/Chem4Word.WebServices/Properties/AssemblyInfo.cs +++ b/src/Chemistry/Chem4Word.WebServices/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Common/Chem4Word.Core/Helpers/Constants.cs b/src/Common/Chem4Word.Core/Helpers/Constants.cs index 5be43f0..0e1fd21 100644 --- a/src/Common/Chem4Word.Core/Helpers/Constants.cs +++ b/src/Common/Chem4Word.Core/Helpers/Constants.cs @@ -31,8 +31,10 @@ public static class Constants public const string RegistryValueNameAvailableVersion = "Available Version"; public const string RegistryValueNameAvailableIsBeta = "Available Is Beta"; public const string RegistryValueNameEndOfLife = "End of Life"; + public const string Chem4WordSetupRegistryKey = @"SOFTWARE\Chem4Word V3\Setup"; public const string Chem4WordUpdateRegistryKey = @"SOFTWARE\Chem4Word V3\Update"; + public const string Chem4WordMsiActionsRegistryKey = @"SOFTWARE\Chem4Word V3\MsiActions"; public const string Chem4WordMessagesRegistryKey = @"SOFTWARE\Chem4Word V3\Messages"; public const string Chem4WordExceptionsRegistryKey = @"SOFTWARE\Chem4Word V3\Exceptions"; public const string Chem4WordAzureSettingsRegistryKey = @"SOFTWARE\Chem4Word V3\AzureSettings"; diff --git a/src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs b/src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs index 0635299..04e9b07 100644 --- a/src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs +++ b/src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs b/src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs index 9cbdfdb..3a4111e 100644 --- a/src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs +++ b/src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs b/src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs index 4315a82..bcc04f7 100644 --- a/src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs +++ b/src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs b/src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs index caa3396..6a06fca 100644 --- a/src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs +++ b/src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Installer/WiX.CustomAction/CustomAction.cs b/src/Installer/WiX.CustomAction/CustomAction.cs index 9f247a3..227643f 100644 --- a/src/Installer/WiX.CustomAction/CustomAction.cs +++ b/src/Installer/WiX.CustomAction/CustomAction.cs @@ -1,4 +1,4 @@ -// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- // Copyright (c) 2024, The .NET Foundation. // This software is released under the Apache License, Version 2.0. // The license and further copyright text can be found in the file LICENSE.md @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Security.AccessControl; @@ -88,6 +89,45 @@ public static ActionResult SetupChem4Word(Session session) return ActionResult.Success; } + [CustomAction] + public static ActionResult SetupChem4WordUser(Session session) + { + session.Log($"Begin {nameof(SetupChem4Word)}()"); + + session.Log($" Running as {Environment.UserName}"); + + try + { + const string baseKey = @"SOFTWARE\Chem4Word V3"; + + var key = Registry.CurrentUser.OpenSubKey(baseKey, true); + if (key == null) + { + key = Registry.CurrentUser.CreateSubKey(baseKey); + } + + string actionsKey = $@"{baseKey}\MsiActions"; + key = Registry.CurrentUser.OpenSubKey(actionsKey, true); + if (key == null) + { + key = key = Registry.CurrentUser.CreateSubKey(actionsKey); + } + + var versionNumber = "3.2.20.8999"; + + string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); + key.SetValue(timestamp, $"[-] V{versionNumber} - Installed"); + } + catch (Exception ex) + { + session.Log($"** Exception: {ex.Message} **"); + } + + session.Log($"End {nameof(SetupChem4Word)}()"); + + return ActionResult.Success; + } + private static void ModifyFolderPermissions(Session session) { session.Log($" Fixing SpecialFolder.CommonApplicationData {ProgramDataFolder}"); @@ -474,4 +514,4 @@ private static void RegisterChem4WordAddIn(Session session, RegistryKey rk, stri session.Log($" End {nameof(RegisterChem4WordAddIn)}()"); } } -} \ No newline at end of file +} diff --git a/src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs b/src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs index 843e445..d6094b0 100644 --- a/src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs +++ b/src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.2.20.9009")] -[assembly: AssemblyFileVersion("3.2.20.9009")] +[assembly: AssemblyVersion("3.2.20.8999")] +[assembly: AssemblyFileVersion("3.2.20.8999")] diff --git a/src/Installer/WiXInstaller/Product.wxs b/src/Installer/WiXInstaller/Product.wxs index f1c0587..6b48e78 100644 --- a/src/Installer/WiXInstaller/Product.wxs +++ b/src/Installer/WiXInstaller/Product.wxs @@ -1,7 +1,7 @@  - + @@ -52,6 +52,7 @@ + @@ -60,6 +61,7 @@ NOT Installed NOT Installed NOT Installed + NOT Installed Installed diff --git a/src/Installer/WiXInstaller/Test.cmd b/src/Installer/WiXInstaller/Test.cmd index 8a34554..14cc51e 100644 --- a/src/Installer/WiXInstaller/Test.cmd +++ b/src/Installer/WiXInstaller/Test.cmd @@ -1,16 +1,18 @@ dir bin\Setup\ rem pause +set release=Chem4Word-Setup.3.2.20.Release.16.msi + del setup.log del remove.log -msiexec /i bin\Setup\Chem4Word-Setup.3.1.16.Release.6.msi /l*v setup.log +msiexec /i bin\Setup\%release% /l*v setup.log -rem pause +pause -msiexec /uninstall bin\Setup\Chem4Word-Setup.3.1.16.Release.6.msi /l*v remove.log +msiexec /uninstall bin\Setup\%release% /l*v remove.log -rem pause +pause rem find "Property(" setup.log > properties.log rem search logs for "Calling custom action WiX.CustomAction" diff --git a/src/Installer/WiXInstaller/Testing/Insert Test Messages.reg b/src/Installer/WiXInstaller/Testing/Insert Test Messages.reg new file mode 100644 index 0000000..c80e614 Binary files /dev/null and b/src/Installer/WiXInstaller/Testing/Insert Test Messages.reg differ diff --git a/src/Installer/WiXInstaller/WiX-Installer.wixproj b/src/Installer/WiXInstaller/WiX-Installer.wixproj index d048a90..ed5d9ff 100644 --- a/src/Installer/WiXInstaller/WiX-Installer.wixproj +++ b/src/Installer/WiXInstaller/WiX-Installer.wixproj @@ -58,6 +58,7 @@ + @@ -69,6 +70,9 @@ INSTALLFOLDER + + +