Skip to content

Commit

Permalink
Merged PR 321: Release of beta 4
Browse files Browse the repository at this point in the history
* Further improvements to StartUp
* Disable Explicit C when charge or isotope present #18
* Fix joining of double bonds to rings #12

Related work items: #676, #679, #680, #685
  • Loading branch information
MikeWilliams-UK committed Jan 18, 2020
1 parent 02ff5b5 commit 9d39d86
Show file tree
Hide file tree
Showing 38 changed files with 176 additions and 109 deletions.
4 changes: 2 additions & 2 deletions src/Chem4Word.V3/Chem4WordV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ private void LoadPluginsOnThread()
{
OnWindowSelectionChange(Application.Selection);
}
LoadOptions();
}
}

Expand Down Expand Up @@ -617,10 +618,9 @@ private void LoadPlugIns(bool mustBeSigned)
var certificate = mod.GetSignerCertificate();
if (certificate != null)
{
signedBy = certificate.Subject;
// [email protected], CN="Open Source Developer, Mike Williams", O=Open Source Developer, C=GB
Debug.WriteLine(certificate.Subject);
signedBy = certificate.Subject;
// CN=Certum Code Signing CA SHA2, OU=Certum Certification Authority, O=Unizeto Technologies S.A., C=PL
Debug.WriteLine(certificate.Issuer);
}

Expand Down
11 changes: 11 additions & 0 deletions src/Chem4Word.V3/Data/Chem4Word-Versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
<!-- This file must be uploaded to https://www.chem4word.co.uk/files3-1/ folder as Chem4Word-Versions.xml -->
<ChangeLog>
<Id>f3c4f4db-2fff-46db-b14a-feb8e09f7742</Id>
<Version>
<Number>3.1.4 Beta 4</Number>
<IsBeta>true</IsBeta>
<Released>18-Jan-2020</Released>
<Changes>
<Change>Further improvements to StartUp</Change>
<Change>Disable Explicit C when charge or isotope present https://github.com/Chem4Word/Version3-1/issues/18 </Change>
<Change>Fix joining of double bonds to rings https://github.com/Chem4Word/Version3-1/issues/12 </Change>
</Changes>
<Url>https://www.chem4word.co.uk/files3-1/Chem4Word-Setup.3.1.4.Beta.4.msi</Url>
</Version>
<Version>
<Number>3.1.3 Beta 3</Number>
<IsBeta>true</IsBeta>
Expand Down
4 changes: 2 additions & 2 deletions src/Chem4Word.V3/Data/This-Version.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Version>
<Number>3.1.3 Beta 3</Number>
<Number>3.1.4 Beta 4</Number>
<IsBeta>true</IsBeta>
<Released>09-Jan-2020</Released>
<Released>18-Jan-2020</Released>
</Version>
4 changes: 4 additions & 0 deletions src/Chem4Word.V3/Data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ <h1>Chemistry for Word Add-In 2020</h1>
<td>Setup Bootstrapper</td>
<td><a href="/files3-1/Chem4Word-Setup.exe">Chem4Word-Setup</a></td>
</tr>
<tr>
<td>Version 3.1.4 - Beta 4</td>
<td><a href="/files3-1/Chem4Word-Setup.3.1.4.Beta.4.msi">Chem4Word-Setup 3.1.4 Beta 4</a></td>
</tr>
<tr>
<td>Version 3.1.3 - Beta 3</td>
<td><a href="/files3-1/Chem4Word-Setup.3.1.3.Beta.3.msi">Chem4Word-Setup 3.1.3 Beta 3</a></td>
Expand Down
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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
4 changes: 2 additions & 2 deletions src/Chem4WordTests/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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
18 changes: 18 additions & 0 deletions src/Chemistry/Chem4Word.ACME/Controls/AtomPropertyEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Windows.Controls;
using System.Windows.Forms;
using Chem4Word.ACME.Annotations;
using Chem4Word.ACME.Entities;
using Chem4Word.ACME.Models;
using Chem4Word.ACME.Resources;
using Chem4Word.ACME.Utils;
Expand Down Expand Up @@ -159,11 +160,28 @@ private void FunctionalGroupPicker_OnSelectionChanged(object sender, SelectionCh

private void ChargeCombo_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
SetStateOfExplicitCarbonCheckbox();
ShowPreview();
}

private void SetStateOfExplicitCarbonCheckbox()
{
var chargeValue = ChargeCombo.SelectedItem as ChargeValue;
var isotopeValue = IsotopePicker.SelectedItem as IsotopeValue;

if (chargeValue?.Value == 0 && isotopeValue?.Mass == null)
{
ExplicitCheckBox.IsEnabled = true;
}
else
{
ExplicitCheckBox.IsEnabled = false;
}
}

private void IsotopePicker_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
SetStateOfExplicitCarbonCheckbox();
ShowPreview();
}

Expand Down
6 changes: 3 additions & 3 deletions src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.3.7313")]
[assembly: AssemblyVersion("3.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
// [assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
6 changes: 3 additions & 3 deletions src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.3.7313")]
[assembly: AssemblyVersion("3.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
// [assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
4 changes: 2 additions & 2 deletions src/Common/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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
64 changes: 44 additions & 20 deletions src/Common/Telemetry/SystemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class SystemHelper
public List<string> StartUpTimings { get; set; }

private static int _retryCount;
private static Stopwatch _stopwatch;

public static string GetMachineId()
{
Expand Down Expand Up @@ -235,14 +236,21 @@ private List<string> Initialise()

#endregion Get Product Version and Location using reflection

#region Get IpAddress
#region Get IpAddress on Thread

message = $"GetIpAddress started at {SafeDate.ToLongDate(DateTime.Now)}";
StartUpTimings.Add(message);
Debug.WriteLine(message);

_stopwatch = new Stopwatch();
_stopwatch.Start();

ParameterizedThreadStart pts = GetExternalIpAddress;
Thread thread = new Thread(pts);
thread.SetApartmentState(ApartmentState.STA);
thread.Start(null);

#endregion Get IpAddress
#endregion Get IpAddress on Thread

GetDotNetVersionFromRegistry();

Expand Down Expand Up @@ -499,28 +507,29 @@ private string HKLM_GetString(string path, string key)
}
}

private static void IncrementRetryCount()
{
_retryCount++;
}

private void GetExternalIpAddress(object o)
{
string module = $"{MethodBase.GetCurrentMethod().Name}()";

string message = $"{module} started at {SafeDate.ToLongDate(DateTime.Now)}";
StartUpTimings.Add(message);
Debug.WriteLine(message);

Stopwatch sw = new Stopwatch();
sw.Start();

// http://www.ipv6proxy.net/ --> "Your IP address : 2600:3c00::f03c:91ff:fe93:dcd4"

try
{
int idx = 0;
foreach (var domain in Domains)
{
try
{
string url = $"{domain}/{DetectionFile}";

Debug.WriteLine("Fetching external IpAddress from " + url + " attempt " + _retryCount);
string message = $"Fetching external IpAddress from {url} attempt {_retryCount}.{idx++}";
Debug.WriteLine(message);
StartUpTimings.Add(message);
IpAddress = "IpAddress 0.0.0.0";

HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
Expand Down Expand Up @@ -599,21 +608,20 @@ private void GetExternalIpAddress(object o)

#endregion Detect Php UTC Date

// Failure, try next one
if (!IpAddress.Contains("0.0.0.0"))
{
break;
}
}

Debug.WriteLine(IpAddress);
}
}
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
// Do Nothing
StartUpTimings.Add($"GetExternalIpAddress {ex.Message}");
}
Thread.Sleep(500);
}
Expand All @@ -623,26 +631,42 @@ private void GetExternalIpAddress(object o)
Debug.WriteLine(ex.Message);
// Something went wrong
IpAddress = "IpAddress 0.0.0.0 - " + ex.Message;
StartUpTimings.Add($"GetExternalIpAddress {ex.Message}");
}

if (string.IsNullOrEmpty(IpAddress) || IpAddress.Contains("0.0.0.0"))
{
if (_retryCount < 5)
// Try 0..4 times from 0..2 domains
if (_retryCount < 4)
{
_retryCount++;
// Retry
IncrementRetryCount();
Thread.Sleep(500);
ParameterizedThreadStart pts = GetExternalIpAddress;
Thread thread = new Thread(pts);
thread.SetApartmentState(ApartmentState.STA);
thread.Start(null);
}
}
else
{
// Failure
IpAddress = IpAddress.Replace("0.0.0.0", "8.8.8.8");
_stopwatch.Stop();

sw.Stop();
var message = $"{module} took {_stopwatch.ElapsedMilliseconds.ToString("#,000")}ms";
StartUpTimings.Add(message);
Debug.WriteLine(message);
}
}
else
{
// Success
_stopwatch.Stop();

message = $"{module} took {sw.ElapsedMilliseconds.ToString("#,000")}ms";
StartUpTimings.Add(message);
Debug.WriteLine(message);
var message = $"{module} took {_stopwatch.ElapsedMilliseconds.ToString("#,000")}ms";
StartUpTimings.Add(message);
Debug.WriteLine(message);
}
}

private DateTime FromPhpDate(string line)
Expand Down
12 changes: 9 additions & 3 deletions src/Common/Telemetry/TelemetryWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ private void WriteStartUpInfo()
WritePrivate("StartUp", "Information", $"Browser Version: {_helper.BrowserVersion}");

// Log IP Address
WritePrivate("StartUp", "Information", _helper.IpAddress); // ** Used by Andy's Knime protocol
WritePrivate("StartUp", "Information", _helper.IpObtainedFrom);
if (!_helper.IpAddress.Contains("8.8.8.8"))
{
WritePrivate("StartUp", "Information", _helper.IpAddress); // ** Used by Andy's Knime protocol
WritePrivate("StartUp", "Information", _helper.IpObtainedFrom);
}

if (_helper.StartUpTimings != null)
{
Expand Down Expand Up @@ -208,7 +211,10 @@ private void WriteStartUpInfo()
WritePrivate("StartUp", "Information", _helper.SystemOs); // ** Used by Andy's Knime protocol

// Log IP Address
WritePrivate("StartUp", "Information", _helper.IpAddress); // ** Used by Andy's Knime protocol
if (!_helper.IpAddress.Contains("8.8.8.8"))
{
WritePrivate("StartUp", "Information", _helper.IpAddress); // ** Used by Andy's Knime protocol
}

#endregion Log critical System Info again to ensure we get it

Expand Down
4 changes: 2 additions & 2 deletions src/Installer/Chem4WordSetup/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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
2 changes: 1 addition & 1 deletion src/Installer/Chem4WordSetup/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public partial class Setup : Form
private const string DetectV2AddIn = @"Chemistry Add-in for Word\Chem4Word.AddIn.vsto";
private const string DetectV3AddIn = @"Chem4Word V3\Chem4Word.V3.vsto";

private const string DefaultMsiFile = "https://www.chem4word.co.uk/files3-1/Chem4Word-Setup.3.1.1.Beta.1.msi";
private const string DefaultMsiFile = "https://www.chem4word.co.uk/files3-1/Chem4Word-Setup.3.1.4.Beta.4.msi";
private const string VstoInstaller = "https://www.chem4word.co.uk/files3-1/vstor_redist.exe";

private WebClient _webClient;
Expand Down
4 changes: 2 additions & 2 deletions src/Installer/Chem4WordUpdater/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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
4 changes: 2 additions & 2 deletions src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
2 changes: 1 addition & 1 deletion src/Installer/WiXInstaller/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- For automatic upgrade to work only first three parts of version number are used -->
<Product Id="*" Name="Chemistry Add-In for Microsoft Word 2020 Beta 3" Manufacturer="Chem4Word" Version="3.1.3.7313" UpgradeCode="865226e7-d29d-49aa-a390-dda49979b102" Language="1033">
<Product Id="*" Name="Chemistry Add-In for Microsoft Word 2020 Beta 4" Manufacturer="Chem4Word" Version="3.1.4.7322" UpgradeCode="865226e7-d29d-49aa-a390-dda49979b102" Language="1033">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of Chem4Word is already installed." />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" CompressionLevel="high" />
Expand Down
2 changes: 1 addition & 1 deletion src/Installer/WiXInstaller/WiX-Installer.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>746e1493-1b1e-482c-8fa4-c147237f4f7b</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Chem4Word-Setup.3.1.3.Beta.3</OutputName>
<OutputName>Chem4Word-Setup.3.1.4.Beta.4</OutputName>
<OutputType>Package</OutputType>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
Expand Down
3 changes: 2 additions & 1 deletion src/Notes/Releases.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Set Build Numbers

.\SetAssemblyVersion.ps1 -version 3.1.3 -name "Beta 3" -released "09-Jan-2020" -path ..
.\SetAssemblyVersion.ps1 -version 3.1.4 -name "Beta 4" -released "18-Jan-2020" -path ..

.\SetAssemblyVersion.ps1 -version 3.1.3 -name "Beta 3" -released "09-Jan-2020" -path ..
.\SetAssemblyVersion.ps1 -version 3.1.2 -name "Beta 2" -released "08-Jan-2020" -path ..
.\SetAssemblyVersion.ps1 -version 3.1.2 -name "Beta 2" -released "02-Jan-2020" -path ..
.\SetAssemblyVersion.ps1 -version 3.1.1 -name "Beta 1" -released "01-Jan-2020" -path ..
Expand Down
4 changes: 2 additions & 2 deletions src/PlugIns/Contracts/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.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.3.7313")]
[assembly: AssemblyVersion("3.1.3.7313")]
[assembly: AssemblyFileVersion("3.1.3.7313")]
// [assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyVersion("3.1.4.7322")]
[assembly: AssemblyFileVersion("3.1.4.7322")]
Loading

0 comments on commit 9d39d86

Please sign in to comment.