Skip to content

Commit

Permalink
Merged PR 672: V3.3.5 Release 3
Browse files Browse the repository at this point in the history
- Correct Facebook url in Help -> About
- Add detection of Office 2024

Related work items: #1127, #1138, #1139
  • Loading branch information
MikeWilliams-UK committed Mar 20, 2024
1 parent d149b6e commit adacc3f
Show file tree
Hide file tree
Showing 35 changed files with 392 additions and 205 deletions.
27 changes: 5 additions & 22 deletions src/Chem4Word.V3/Chem4WordOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ public class Chem4WordOptions
/// </summary>
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<string>();
RestoreDefaults();
}
Expand All @@ -103,11 +99,6 @@ public Chem4WordOptions()
/// <param name="path">Folder where the Chem4Word options are to reside - pass null to load from default path</param>
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<string>();
Load();
Expand Down Expand Up @@ -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<Chem4WordOptions>(fileContents);
var settings = new JsonSerializerSettings
{
CheckAdditionalContent = false
};
var options = JsonConvert.DeserializeObject<Chem4WordOptions>(fileContents, settings);
SetValuesFromCopy(options);

var temp = JsonConvert.SerializeObject(options, Formatting.Indented);
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Chem4WordV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions src/Chem4Word.V3/Data/Chem4Word-Versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<Version>
<Number>3.3.5 Release 3</Number>
<IsBeta>false</IsBeta>
<Released>31-Mar-2024</Released>
<Released>20-Mar-2024</Released>
<Changes>
<Change>...</Change>
<Change>...</Change>
<Change>Correct Facebook url in Help -> About</Change>
<Change>Add detection of Office 2024</Change>
<Change>If you like our product, please consider buying us a coffee at https://www.buymeacoffee.com/chem4word</Change>
<Change>Please download Chem4Word-Setup.exe via https://www.chem4word.co.uk/download/ if you encounter any difficulties updating</Change>
</Changes>
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Data/This-Version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<Version>
<Number>3.3.5 Release 3</Number>
<IsBeta>false</IsBeta>
<Released>31-Mar-2024</Released>
<Released>20-Mar-2024</Released>
</Version>
4 changes: 2 additions & 2 deletions src/Chem4Word.V3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/UI/WPF/AboutControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
13 changes: 9 additions & 4 deletions src/Chem4Word.V3/UI/WPF/LibraryDownloadControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
12 changes: 11 additions & 1 deletion src/Common/Chem4Word.Telemetry/TelemetryWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -217,10 +226,11 @@ private void WriteStartUpInfo()
// Log Wmi Gathered Data
lines = new List<string>();

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}");

Expand Down
Loading

0 comments on commit adacc3f

Please sign in to comment.