Skip to content

Commit

Permalink
version 2.0.5.0: bugfix for API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tushev committed Nov 20, 2023
1 parent 892a9d3 commit 548f258
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/AJUpdateWatcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@
<Reference Include="System.Management" />
<Reference Include="System.Net" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Tasks.Dataflow, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Dataflow.5.0.0\lib\net461\System.Threading.Tasks.Dataflow.dll</HintPath>
<Reference Include="System.Threading.Tasks.Dataflow, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Dataflow.8.0.0\lib\net462\System.Threading.Tasks.Dataflow.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
Expand Down
15 changes: 13 additions & 2 deletions src/Classes/Adoptium/AdoptiumAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,20 @@ static public AdoptiumReleaseVersion GetLatestVersion(string version, string imp
latest.ImageType = image_type;

// see https://github.com/AdoptOpenJDK/TSC/issues/185#issuecomment-724696068
latest.MSIRevision = Convert.ToInt32(semantic_version.Split('+').Last());
/*
* semver = major.minor.security + ((patch * 100) + build)
* MSI product version = major.minor.security.((patch * 100) + build)
* eg.jdk - 11.0.9.1 + 1
* => semver = 11.0.9 + 101
* => MSI product version = 11.0.9.101
*/
// valid for older releases, should consult vendors for newer releases
try
{
string after_plus = semantic_version.Split('+').Last();
latest.MSIRevision = GetLeadingInt(after_plus.Split('.').First());
}
catch (Exception) { Debug.WriteLine($"[PARSE_ERROR] Error parsing semantic_version: {semantic_version}"); }

latest.Found = true;
break;
Expand All @@ -225,13 +231,18 @@ static public AdoptiumReleaseVersion GetLatestVersion(string version, string imp
var ie = ex;
while (ie.InnerException != null) ie = ie.InnerException;

error_message_out += $"GetLatestVersion[{URL}]: {ex.Message}" + (ie.Message != null ? $" => {ie.Message}" : "");
error_message_out += $"GetLatestVersion[{URL}]: {ex.Message}" + (ie.Message != null ? $" => {ie.Message}" : "") + " " + ex.TargetSite ?? "";
//if (latest.)
Debug.WriteLine(error_message_out);
//MessageBox.Show("There was an error: " + ex.Message, "Adoptium API Error", MessageBoxButton.OK, MessageBoxImage.Error);
}

return latest;
}

static int GetLeadingInt(string input)
{
return Int32.Parse(new string(input.Trim().TakeWhile(c => char.IsDigit(c) || c == '.').ToArray()));
}
}
}
6 changes: 3 additions & 3 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("tushev.org")]
[assembly: AssemblyProduct("Update Watcher for AdoptOpenJDK")]
[assembly: AssemblyCopyright("Copyright © Simon A. Tushev, 2020-2021")]
[assembly: AssemblyCopyright("Copyright © Simon A. Tushev, 2020-2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.4.0")]
[assembly: AssemblyFileVersion("2.0.4.0")]
[assembly: AssemblyVersion("2.0.5.0")]
[assembly: AssemblyFileVersion("2.0.5.0")]
4 changes: 2 additions & 2 deletions src/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AeroWizard" version="2.3.1" targetFramework="net472" />
<package id="DotNetProjects.Extended.Wpf.Toolkit" version="5.0.106" targetFramework="net472" />
Expand All @@ -10,7 +10,7 @@
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="System.Runtime.WindowsRuntime" version="4.7.0" targetFramework="net472" />
<package id="System.Runtime.WindowsRuntime.UI.Xaml" version="4.7.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Dataflow" version="7.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Dataflow" version="8.0.0" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="TaskScheduler" version="2.10.1" targetFramework="net472" />
<package id="TaskSchedulerEditor" version="2.10.1" targetFramework="net472" />
Expand Down

0 comments on commit 548f258

Please sign in to comment.