diff --git a/src/Chem4Word.V3/Chem4WordOptions.cs b/src/Chem4Word.V3/Chem4WordOptions.cs index 2ebba91..1cb3259 100644 --- a/src/Chem4Word.V3/Chem4WordOptions.cs +++ b/src/Chem4Word.V3/Chem4WordOptions.cs @@ -89,10 +89,6 @@ public class Chem4WordOptions /// public Chem4WordOptions() { - var module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; - // ToDo: [MAW] Take this out after beta is completed - RegistryHelper.StoreMessage(module, "Chem4WordOptions()"); - Errors = new List(); RestoreDefaults(); } @@ -103,11 +99,6 @@ public Chem4WordOptions() /// Folder where the Chem4Word options are to reside - pass null to load from default path public Chem4WordOptions(string path) { - var module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; - // ToDo: [MAW] Take this out after beta is completed - RegistryHelper.StoreMessage(module, "Chem4WordOptions(string path)"); - RegistryHelper.StoreMessage(module, $"path = {path}"); - SettingsPath = path; Errors = new List(); Load(); @@ -184,10 +175,11 @@ public void Load() } else { - // ToDo: [MAW] Take this out after beta is completed - RegistryHelper.StoreMessage(module, fileContents); - - var options = JsonConvert.DeserializeObject(fileContents); + var settings = new JsonSerializerSettings + { + CheckAdditionalContent = false + }; + var options = JsonConvert.DeserializeObject(fileContents, settings); SetValuesFromCopy(options); var temp = JsonConvert.SerializeObject(options, Formatting.Indented); @@ -300,18 +292,9 @@ private string ReadOptionsFile(string filename) private void PersistOptions(string filename) { - var module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; - try { - // ToDo: [MAW] Take this out after beta is completed - RegistryHelper.StoreMessage(module, $"Saving Chem4Word Options to {filename}"); - Debug.WriteLine($"Saving Chem4Word Options to {filename}"); - var contents = JsonConvert.SerializeObject(this, Formatting.Indented); - // ToDo: [MAW] Take this out after beta is completed - RegistryHelper.StoreMessage(module, contents); - using (var outStream = new FileStream(filename, FileMode.Create, FileAccess.Write, diff --git a/src/Chem4Word.V3/Chem4WordV3.cs b/src/Chem4Word.V3/Chem4WordV3.cs index 8e13ffe..1f97b6d 100644 --- a/src/Chem4Word.V3/Chem4WordV3.cs +++ b/src/Chem4Word.V3/Chem4WordV3.cs @@ -503,7 +503,7 @@ public void LoadOptions() // ... as we are seeing some errors here ? // Re-Initialise Telemetry with granted permissions - Telemetry = new TelemetryWriter(IsBeta || SystemOptions.TelemetryEnabled, IsBeta, Helper); + Telemetry = new TelemetryWriter(IsBeta || Debugger.IsAttached || SystemOptions.TelemetryEnabled, IsBeta, Helper); try { diff --git a/src/Chem4Word.V3/Data/Chem4Word-Versions.xml b/src/Chem4Word.V3/Data/Chem4Word-Versions.xml index 2ab5848..0d7795d 100644 --- a/src/Chem4Word.V3/Data/Chem4Word-Versions.xml +++ b/src/Chem4Word.V3/Data/Chem4Word-Versions.xml @@ -5,10 +5,10 @@ 3.3.5 Release 3 false - 31-Mar-2024 + 20-Mar-2024 - ... - ... + Correct Facebook url in Help -> About + Add detection of Office 2024 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 e89447f..23af05e 100644 --- a/src/Chem4Word.V3/Data/This-Version.xml +++ b/src/Chem4Word.V3/Data/This-Version.xml @@ -2,5 +2,5 @@ 3.3.5 Release 3 false - 31-Mar-2024 + 20-Mar-2024 \ No newline at end of file diff --git a/src/Chem4Word.V3/Properties/AssemblyInfo.cs b/src/Chem4Word.V3/Properties/AssemblyInfo.cs index af0ba37..a98dfca 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Chem4Word.V3/UI/WPF/AboutControl.xaml.cs b/src/Chem4Word.V3/UI/WPF/AboutControl.xaml.cs index e76aa47..14408b9 100644 --- a/src/Chem4Word.V3/UI/WPF/AboutControl.xaml.cs +++ b/src/Chem4Word.V3/UI/WPF/AboutControl.xaml.cs @@ -173,7 +173,7 @@ private void OnClick_YouTube(object sender, RoutedEventArgs e) try { - Process.Start("https://www.youtube.com/channel/UCKX2kG9kZ3zoX0nCen5lfpQ"); + Process.Start("https://www.youtube.com/@chem4word"); } catch (Exception ex) { diff --git a/src/Chem4Word.V3/UI/WPF/LibraryDownloadControl.xaml.cs b/src/Chem4Word.V3/UI/WPF/LibraryDownloadControl.xaml.cs index 72611fd..9206f91 100644 --- a/src/Chem4Word.V3/UI/WPF/LibraryDownloadControl.xaml.cs +++ b/src/Chem4Word.V3/UI/WPF/LibraryDownloadControl.xaml.cs @@ -515,16 +515,21 @@ private void OnClick_BuyButton(object sender, RoutedEventArgs e) if (Libraries.SelectedItem is LibraryDownloadGridSource data) { var stringBuilder = new StringBuilder(); - stringBuilder.AppendLine($"Please purchase the library '{data.Name}' from our shop,"); - stringBuilder.AppendLine(" then return to here to download it when you receive an email confirming your purchase"); - stringBuilder.AppendLine($"Clicking OK will open your default browser with '{data.Name}' selected"); + stringBuilder.AppendLine($"Please purchase the library '{data.Name}' from our shop."); + stringBuilder.AppendLine("NB: Some libraries are FREE!"); + stringBuilder.AppendLine($"Clicking OK will open your default browser with library '{data.Name}' selected."); + stringBuilder.AppendLine("After you receive an email confirming your purchase, return here to download it."); var answer = UserInteractions.AskUserOkCancel(stringBuilder.ToString()); if (answer == DialogResult.OK) { // With the help of https://stackoverflow.com/questions/64086598/redirect-product-sku-from-url-to-the-related-product-in-woocommerce // we now have a redirect from SKU to product name // e.g. https://www.chem4word.co.uk/product/d91e2e64-95dd-4652-ac23-5c07a261a1b4 ==> https://www.chem4word.co.uk/product/simple-heterocycles - Process.Start($"https://www.chem4word.co.uk/product/{data.Sku}"); + + var productPage = $"https://www.chem4word.co.uk/product/{data.Sku}"; + + Globals.Chem4WordV3.Telemetry.Write(module, "Action", $"Opening {productPage}"); + Process.Start(productPage); } } } diff --git a/src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs index a5a01fc..4bcb6b7 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs index 53daf0c..76ac503 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Chemistry/Chem4Word.WebServices/Properties/AssemblyInfo.cs b/src/Chemistry/Chem4Word.WebServices/Properties/AssemblyInfo.cs index 18165b1..b333958 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs b/src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs index e53ec8d..654b337 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs b/src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs index 8f2e514..b259ee0 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Common/Chem4Word.Telemetry/TelemetryWriter.cs b/src/Common/Chem4Word.Telemetry/TelemetryWriter.cs index 23d5d3c..2b59dcb 100644 --- a/src/Common/Chem4Word.Telemetry/TelemetryWriter.cs +++ b/src/Common/Chem4Word.Telemetry/TelemetryWriter.cs @@ -28,6 +28,7 @@ public class TelemetryWriter : IChem4WordTelemetry private static SystemHelper _helper; private static WmiHelper _wmiHelper; + private static bool _machineIdWritten; private readonly bool _permissionGranted; private readonly bool _isBeta; @@ -80,6 +81,14 @@ public void Write(string source, string level, string message) $@"Chem4Word.V3\Telemetry\{SafeDate.ToIsoShortDate(DateTime.UtcNow)}.log"); using (StreamWriter w = File.AppendText(fileName)) { + if (!_machineIdWritten) + { + if (_helper != null && _helper.MachineId != Guid.Empty.ToString("D")) + { + w.WriteLine($"[{SafeDate.ToShortTime(DateTime.UtcNow)}] * InstallationId: {_helper.MachineId}"); + _machineIdWritten = true; + } + } string logMessage = $"[{SafeDate.ToShortTime(DateTime.UtcNow)}] {source} - {level} - {message}"; w.WriteLine(logMessage); } @@ -217,10 +226,11 @@ private void WriteStartUpInfo() // Log Wmi Gathered Data lines = new List(); + lines.Add($"SYS: {_wmiHelper.Manufacturer} - {_wmiHelper.Model} - {_wmiHelper.SystemFamily}"); lines.Add($"CPU: {_wmiHelper.CpuName}"); lines.Add($"CPU Cores: {_wmiHelper.LogicalProcessors}"); lines.Add($"CPU Speed: {_wmiHelper.CpuSpeed}"); - lines.Add($"Physical Memory: {_wmiHelper.PhysicalMemory}"); + lines.Add($"Memory: {_wmiHelper.TotalPhysicalMemory}"); lines.Add($"Booted Up: {_helper.LastBootUpTime}"); lines.Add($"Logged In: {_helper.LastLoginTime}"); diff --git a/src/Common/Chem4Word.Telemetry/WmiHelper.cs b/src/Common/Chem4Word.Telemetry/WmiHelper.cs index 20892f5..1cdd201 100644 --- a/src/Common/Chem4Word.Telemetry/WmiHelper.cs +++ b/src/Common/Chem4Word.Telemetry/WmiHelper.cs @@ -15,25 +15,87 @@ namespace Chem4Word.Telemetry { public class WmiHelper { - private const string QueryProcessor = "SELECT Name,NumberOfLogicalProcessors,CurrentClockSpeed FROM Win32_Processor"; - private const string QueryOperatingSystem = "SELECT ProductType,Caption,Version FROM Win32_OperatingSystem"; - private const string QueryPhysicalMemory = "SELECT Capacity FROM Win32_PhysicalMemory"; - private const string QueryAntiVirusProduct = "SELECT DisplayName,ProductState FROM AntiVirusProduct"; - private const string Workstation = "Workstation"; private const string DomainController = "Domain Controller"; private const string Server = "Server"; - private const string Unknown = "Unknown"; public WmiHelper() { + GetWin32ComputerSystemData(); GetWin32ProcessorData(); - GetWin32PhysicalMemoryData(); GetWin32OperatingSystemData(); GetAntiVirusStatus(); } + #region Fields + + private string _manufacturer; + + public string Manufacturer + { + get + { + if (_manufacturer == null) + { + try + { + GetWin32ComputerSystemData(); + } + catch (Exception) + { + // Do Nothing + } + } + + return _manufacturer; + } + } + + private string _model; + + public string Model + { + get + { + if (_model == null) + { + try + { + GetWin32ComputerSystemData(); + } + catch (Exception) + { + // Do Nothing + } + } + + return _model; + } + } + + private string _systemFamily; + + public string SystemFamily + { + get + { + if (_systemFamily == null) + { + try + { + GetWin32ComputerSystemData(); + } + catch (Exception) + { + // Do Nothing + } + } + + return _systemFamily; + } + } + private string _cpuName; public string CpuName @@ -48,7 +110,7 @@ public string CpuName } catch (Exception) { - // + // Do Nothing } } @@ -56,35 +118,35 @@ public string CpuName } } - private string _cpuSpeed; + private string _totalPhysicalMemory; - public string CpuSpeed + public string TotalPhysicalMemory { get { - if (_cpuSpeed == null) + if (_totalPhysicalMemory == null) { try { - GetWin32ProcessorData(); + GetWin32ComputerSystemData(); } catch (Exception) { - // + // Do Nothing } } - return _cpuSpeed; + return _totalPhysicalMemory; } } - private string _logicalProcessors; + private string _cpuSpeed; - public string LogicalProcessors + public string CpuSpeed { get { - if (_logicalProcessors == null) + if (_cpuSpeed == null) { try { @@ -92,33 +154,33 @@ public string LogicalProcessors } catch (Exception) { - // + // Do Nothing } } - return _logicalProcessors; + return _cpuSpeed; } } - private string _physicalMemory; + private string _logicalProcessors; - public string PhysicalMemory + public string LogicalProcessors { get { - if (_physicalMemory == null) + if (_logicalProcessors == null) { try { - GetWin32PhysicalMemoryData(); + GetWin32ProcessorData(); } catch (Exception) { - // + // Do Nothing } } - return _physicalMemory; + return _logicalProcessors; } } @@ -136,7 +198,7 @@ public string OSCaption } catch (Exception) { - // + // Do Nothing } } @@ -158,7 +220,7 @@ public string OSVersion } catch (Exception) { - // + // Do Nothing } } @@ -180,7 +242,7 @@ public string ProductType } catch (Exception) { - // + // Do Nothing } } @@ -196,125 +258,201 @@ public string AntiVirusStatus { if (_antiVirusStatus == null) { - GetAntiVirusStatus(); + try + { + GetAntiVirusStatus(); + } + catch (Exception) + { + // Do Nothing + } } return _antiVirusStatus; } } - private void GetWin32ProcessorData() + #endregion Fields + + private void GetWin32ComputerSystemData() { - ManagementObjectSearcher searcher = new ManagementObjectSearcher(QueryProcessor); - ManagementObjectCollection objCol = searcher.Get(); + var fields = new List { "Manufacturer", "Model", "SystemFamily", "TotalPhysicalMemory" }; + + var sysObjects = GetWmiObjects(@"root\CIMV2", "Win32_ComputerSystem", fields); - foreach (var o in objCol) + foreach (var managementBaseObject in sysObjects) { - var mgtObject = (ManagementObject)o; - try + var mgtObject = (ManagementObject)managementBaseObject; + foreach (var field in fields) { - string temp = mgtObject["Name"].ToString(); - // Replace tab with space - temp = temp.Replace("\t", " "); - // Replace up to 15 double spaces with single space - int i = 0; - while (temp.IndexOf(" ", StringComparison.InvariantCulture) != -1) + switch (field) { - temp = temp.Replace(" ", " "); - i++; - if (i > 15) - { + case "Manufacturer": + try + { + _manufacturer = ObjectAsString(mgtObject[field]); + } + catch + { + _manufacturer = "?"; + } break; - } - } - _cpuName = temp; - } - catch - { - _cpuName = "?"; - } + case "Model": + try + { + _model = ObjectAsString(mgtObject[field]); + } + catch + { + _model = "?"; + } + break; - try - { - _logicalProcessors = mgtObject["NumberOfLogicalProcessors"].ToString(); - } - catch - { - _logicalProcessors = "?"; - } + case "SystemFamily": + try + { + _systemFamily = ObjectAsString(mgtObject[field]); + } + catch + { + _systemFamily = "?"; + } + break; - try - { - double speed = double.Parse(mgtObject["CurrentClockSpeed"].ToString()) / 1024; - _cpuSpeed = SafeDouble.AsString(speed) + "GHz"; - } - catch - { - _cpuSpeed = "?"; + case "TotalPhysicalMemory": + try + { + var temp = ObjectAsString(mgtObject[field]); + var memory = ulong.Parse(temp); + _totalPhysicalMemory = SafeDouble.AsString0((double)memory / (1024 * 1024 * 1024)) + "GiB"; + } + catch + { + _totalPhysicalMemory = "?"; + } + break; + } } } } - private void GetWin32OperatingSystemData() + private void GetWin32ProcessorData() { - ManagementObjectSearcher searcher = new ManagementObjectSearcher(QueryOperatingSystem); - ManagementObjectCollection objCol = searcher.Get(); + var fields = new List { "Name", "NumberOfLogicalProcessors", "MaxClockSpeed" }; - try + var sysObjects = GetWmiObjects(@"root\CIMV2", "Win32_Processor", fields); + + foreach (var managementBaseObject in sysObjects) { - foreach (var o in objCol) + var mgtObject = (ManagementObject)managementBaseObject; + foreach (var field in fields) { - var mgtObject = (ManagementObject)o; - - var productType = int.Parse(mgtObject["ProductType"].ToString()); - switch (productType) + switch (field) { - case 1: - _productType = Workstation; - break; - - case 2: - _productType = DomainController; + case "Name": + try + { + _cpuName = ObjectAsString(mgtObject[field]); + } + catch + { + _cpuName = "?"; + } break; - case 3: - _productType = Server; + case "NumberOfLogicalProcessors": + try + { + _logicalProcessors = ObjectAsString(mgtObject[field]); + } + catch + { + _logicalProcessors = "?"; + } break; - default: - _productType = Unknown + $" [{productType}]"; + case "MaxClockSpeed": + try + { + var speed = double.Parse(ObjectAsString(mgtObject[field])) / 1024; + _cpuSpeed = SafeDouble.AsString(speed) + "GHz"; + } + catch + { + _cpuSpeed = "?"; + } break; } - - _osCaption = mgtObject["Caption"].ToString(); - _osVersion = mgtObject["Version"].ToString(); } } - catch - { - // Do Nothing - } } - private void GetWin32PhysicalMemoryData() + private void GetWin32OperatingSystemData() { - ManagementObjectSearcher searcher = new ManagementObjectSearcher(QueryPhysicalMemory); - ManagementObjectCollection objCol = searcher.Get(); + var fields = new List { "ProductType", "Caption", "Version" }; - try + var sysObjects = GetWmiObjects(@"root\CIMV2", "Win32_OperatingSystem", fields); + + foreach (var managementBaseObject in sysObjects) { - UInt64 capacity = 0; - foreach (var o in objCol) + var mgtObject = (ManagementObject)managementBaseObject; + foreach (var field in fields) { - var mgtObject = (ManagementObject)o; - capacity += (UInt64)mgtObject["Capacity"]; + switch (field) + { + case "ProductType": + try + { + var productType = int.Parse(ObjectAsString(mgtObject[field])); + switch (productType) + { + case 1: + _productType = Workstation; + break; + + case 2: + _productType = DomainController; + break; + + case 3: + _productType = Server; + break; + + default: + _productType = Unknown + $" [{productType}]"; + break; + } + } + catch + { + _productType = "?"; + } + break; + + case "Caption": + try + { + _osCaption = ObjectAsString(mgtObject[field]); + } + catch + { + _osCaption = "?"; + } + break; + + case "Version": + try + { + _osVersion = ObjectAsString(mgtObject[field]); + } + catch + { + _osVersion = "?"; + } + break; + } } - _physicalMemory = SafeDouble.AsString0((double)capacity / (1024 * 1024 * 1024)) + "GB"; - } - catch - { - _physicalMemory = "?"; } } @@ -331,18 +469,20 @@ private void GetAntiVirusStatus() // Only works if not a server if (!string.IsNullOrEmpty(ProductType) && ProductType.Equals(Workstation)) { - ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\SecurityCenter2", QueryAntiVirusProduct); - ManagementObjectCollection objCol = searcher.Get(); + var fields = new List { "DisplayName", "ProductState"}; + + var sysObjects = GetWmiObjects(@"root\SecurityCenter2", "AntiVirusProduct", fields); try { - List products = new List(); - foreach (var o in objCol) + var products = new List(); + + foreach (var managementBaseObject in sysObjects) { - var mgtObject = (ManagementObject)o; - var product = mgtObject["DisplayName"].ToString(); + var mgtObject = (ManagementObject)managementBaseObject; - var status = int.Parse(mgtObject["ProductState"].ToString()); + var product = ObjectAsString(mgtObject["DisplayName"]); + var status = int.Parse(ObjectAsString(mgtObject["ProductState"])); var hex = Hex(status); var bin = Binary(status); @@ -353,9 +493,9 @@ private void GetAntiVirusStatus() // 13th bit = On Access Scanning (Memory Resident Scanning) is on, this tells you that the product is scanning every file that you open as opposed to just scanning at regular intervals. // 5th Bit = If this is true (==1) the virus scanner is out of date - bool enabled = GetBit(reversed, 18); - bool scanning = GetBit(reversed, 12); - bool outdated = GetBit(reversed, 4); + var enabled = GetBit(reversed, 18); + var scanning = GetBit(reversed, 12); + var outdated = GetBit(reversed, 4); products.Add($"{product} Status: {status} [0x{hex}] --> Enabled: {enabled} Scanning: {scanning} Outdated: {outdated}"); } @@ -370,6 +510,41 @@ private void GetAntiVirusStatus() } } + private ManagementObjectCollection GetWmiObjects(string nameSpace, string className, List fields) + { + // https://stackoverflow.com/questions/28989279/communicating-with-non-english-wmi + // https://www.autoitscript.com/autoit3/docs/appendix/OSLangCodes.htm + + var options = new ConnectionOptions + { + Locale = "MS_409" // en-US + }; + var scope = new ManagementScope($"{nameSpace}", options); + scope.Connect(); + + var objectQuery = new ObjectQuery($"SELECT {string.Join(",", fields)} FROM {className}"); + + var searcher = new ManagementObjectSearcher(scope, objectQuery); + var objects = searcher.Get(); + + return objects; + } + + #region Utility methods + + private string ObjectAsString(object input) + { + var temp = input.ToString(); + + // Replace tab with space + temp = temp.Replace("\t", " "); + + // Replace double spaces with single space + temp = temp.Replace(" ", " "); + + return temp.Trim(); + } + private string Hex(int value) { try @@ -417,5 +592,7 @@ private bool GetBit(string value, int index) return false; } } + + #endregion Utility methods } } \ No newline at end of file diff --git a/src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs b/src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs index 35cd15e..591503a 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs b/src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs index 15224fc..30d79fa 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs b/src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs index 1ead0f1..6aff68a 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.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Installer/WiXInstaller/Product.wxs b/src/Installer/WiXInstaller/Product.wxs index 9956f1f..bddc1d9 100644 --- a/src/Installer/WiXInstaller/Product.wxs +++ b/src/Installer/WiXInstaller/Product.wxs @@ -1,7 +1,7 @@  - + diff --git a/src/Notes/Releases.txt b/src/Notes/Releases.txt index d1f6e0d..167f70f 100644 --- a/src/Notes/Releases.txt +++ b/src/Notes/Releases.txt @@ -1,6 +1,6 @@ # Set Build Numbers -.\Set-Assembly-Version.ps1 -version 3.3.5 -name "Release 3" -released "31-Mar-2024" -path .. +.\Set-Assembly-Version.ps1 -version 3.3.5 -name "Release 3" -released "20-Mar-2024" -path .. .\Set-Assembly-Version.ps1 -version 3.3.4 -name "Release 2" -released "29-Feb-2024" -path .. .\Set-Assembly-Version.ps1 -version 3.3.3 -name "Release 1" -released "14-Feb-2024" -path .. diff --git a/src/PlugIns/Contracts/Properties/AssemblyInfo.cs b/src/PlugIns/Contracts/Properties/AssemblyInfo.cs index c0cb9cb..6965745 100644 --- a/src/PlugIns/Contracts/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Contracts/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Drivers/Chem4Word.Driver.Dummy/Properties/AssemblyInfo.cs b/src/PlugIns/Drivers/Chem4Word.Driver.Dummy/Properties/AssemblyInfo.cs index ad364e0..c876731 100644 --- a/src/PlugIns/Drivers/Chem4Word.Driver.Dummy/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Drivers/Chem4Word.Driver.Dummy/Properties/AssemblyInfo.cs @@ -37,6 +37,6 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +// [assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Drivers/Chem4Word.Driver.Open/Properties/AssemblyInfo.cs b/src/PlugIns/Drivers/Chem4Word.Driver.Open/Properties/AssemblyInfo.cs index 3934a94..fd0a1a0 100644 --- a/src/PlugIns/Drivers/Chem4Word.Driver.Open/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Drivers/Chem4Word.Driver.Open/Properties/AssemblyInfo.cs @@ -37,6 +37,6 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +// [assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Editors/Chem4Word.Editor.ACME/Properties/AssemblyInfo.cs b/src/PlugIns/Editors/Chem4Word.Editor.ACME/Properties/AssemblyInfo.cs index bda50a3..6ff5d79 100644 --- a/src/PlugIns/Editors/Chem4Word.Editor.ACME/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Editors/Chem4Word.Editor.ACME/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Editors/ChemDoodleWeb.800/Properties/AssemblyInfo.cs b/src/PlugIns/Editors/ChemDoodleWeb.800/Properties/AssemblyInfo.cs index ccd8228..6fb02d7 100644 --- a/src/PlugIns/Editors/ChemDoodleWeb.800/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Editors/ChemDoodleWeb.800/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Editors/SimpleWpfEditor/Properties/AssemblyInfo.cs b/src/PlugIns/Editors/SimpleWpfEditor/Properties/AssemblyInfo.cs index 2aa1b8f..7e1819b 100644 --- a/src/PlugIns/Editors/SimpleWpfEditor/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Editors/SimpleWpfEditor/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Renderers/OoXmlV4/Properties/AssemblyInfo.cs b/src/PlugIns/Renderers/OoXmlV4/Properties/AssemblyInfo.cs index 3414f7f..e92ee76 100644 --- a/src/PlugIns/Renderers/OoXmlV4/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Renderers/OoXmlV4/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Searchers/Chem4Word.Searcher.ChEBIPlugin/Properties/AssemblyInfo.cs b/src/PlugIns/Searchers/Chem4Word.Searcher.ChEBIPlugin/Properties/AssemblyInfo.cs index 4e6eca4..f649c83 100644 --- a/src/PlugIns/Searchers/Chem4Word.Searcher.ChEBIPlugin/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Searchers/Chem4Word.Searcher.ChEBIPlugin/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Searchers/Chem4Word.Searcher.ExamplePlugIn/Properties/AssemblyInfo.cs b/src/PlugIns/Searchers/Chem4Word.Searcher.ExamplePlugIn/Properties/AssemblyInfo.cs index d02bfc3..aad1fd0 100644 --- a/src/PlugIns/Searchers/Chem4Word.Searcher.ExamplePlugIn/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Searchers/Chem4Word.Searcher.ExamplePlugIn/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Searchers/Chem4Word.Searcher.OpsinPlugIn/Properties/AssemblyInfo.cs b/src/PlugIns/Searchers/Chem4Word.Searcher.OpsinPlugIn/Properties/AssemblyInfo.cs index e9d13d3..461ea23 100644 --- a/src/PlugIns/Searchers/Chem4Word.Searcher.OpsinPlugIn/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Searchers/Chem4Word.Searcher.OpsinPlugIn/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/PlugIns/Searchers/Chem4Word.Searcher.PubChemPlugIn/Properties/AssemblyInfo.cs b/src/PlugIns/Searchers/Chem4Word.Searcher.PubChemPlugIn/Properties/AssemblyInfo.cs index f51402e..fe8a27e 100644 --- a/src/PlugIns/Searchers/Chem4Word.Searcher.PubChemPlugIn/Properties/AssemblyInfo.cs +++ b/src/PlugIns/Searchers/Chem4Word.Searcher.PubChemPlugIn/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/Shared/OfficeHelper.cs b/src/Shared/OfficeHelper.cs index 6cfe7bc..4f9af9c 100644 --- a/src/Shared/OfficeHelper.cs +++ b/src/Shared/OfficeHelper.cs @@ -214,6 +214,18 @@ private static string DecodeClickToRun(string clickToRun) } } + if (string.IsNullOrEmpty(versionNumber)) + { + foreach (var p2 in products) + { + if (p2.Contains("2024")) + { + versionNumber = "2024"; + break; + } + } + } + if (string.IsNullOrEmpty(versionNumber)) { foreach (var p2 in products) diff --git a/src/TestHarness/LibraryTransformer/Properties/AssemblyInfo.cs b/src/TestHarness/LibraryTransformer/Properties/AssemblyInfo.cs index 8ed5c20..8e5abe6 100644 --- a/src/TestHarness/LibraryTransformer/Properties/AssemblyInfo.cs +++ b/src/TestHarness/LibraryTransformer/Properties/AssemblyInfo.cs @@ -37,6 +37,6 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +// [assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/TestHarness/WinForms.TestHarness/Properties/AssemblyInfo.cs b/src/TestHarness/WinForms.TestHarness/Properties/AssemblyInfo.cs index ab998dc..61262b3 100644 --- a/src/TestHarness/WinForms.TestHarness/Properties/AssemblyInfo.cs +++ b/src/TestHarness/WinForms.TestHarness/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/TestHarness/Wpf.UI.Sandbox/Properties/AssemblyInfo.cs b/src/TestHarness/Wpf.UI.Sandbox/Properties/AssemblyInfo.cs index 699c802..f460124 100644 --- a/src/TestHarness/Wpf.UI.Sandbox/Properties/AssemblyInfo.cs +++ b/src/TestHarness/Wpf.UI.Sandbox/Properties/AssemblyInfo.cs @@ -46,6 +46,6 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +// [assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")] diff --git a/src/UnitTests/Properties/AssemblyInfo.cs b/src/UnitTests/Properties/AssemblyInfo.cs index 97fc471..2a08ad0 100644 --- a/src/UnitTests/Properties/AssemblyInfo.cs +++ b/src/UnitTests/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.3.5.8856")] -[assembly: AssemblyFileVersion("3.3.5.8856")] +[assembly: AssemblyVersion("3.3.5.8845")] +[assembly: AssemblyFileVersion("3.3.5.8845")]