Skip to content

Commit

Permalink
improve chipset detection and error indication
Browse files Browse the repository at this point in the history
  • Loading branch information
realies committed Jul 8, 2024
1 parent e8cd80e commit 611cfd8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ async Task InitializeAsync()
if (this.detectedChipset != null)
{
this.latestVersionUrl = await this.FetchLatestVersionUrl(this.detectedChipset);
this.latestVersion = this.latestVersionUrl.Split('_').Last().Replace(".exe", string.Empty);
this.InstallDriversButton.IsEnabled = true;
this.latestVersion = this.latestVersionUrl?.Split('_').Last().Replace(".exe", string.Empty);
if (this.latestVersion != null)
{
this.InstallDriversButton.IsEnabled = true;
}
}

this.LatestVersionText.Text = this.latestVersion ?? "Error fetching";
Expand Down Expand Up @@ -129,12 +132,12 @@ public async Task<string> FetchLatestVersionUrl(string chipset)
{
string driversPageUrl = "https://www.amd.com/en/support/download/drivers.html";
string driversPageContent = await this.client.GetStringAsync(driversPageUrl);
string driversPagePattern = $@"https://[^\s""']*{Regex.Escape(chipset)}\.html";
string driversPagePattern = $@"https://[^""&]+{Regex.Escape(chipset)}\.html";
Match driversUrlMatch = Regex.Match(driversPageContent, driversPagePattern, RegexOptions.IgnoreCase);
if (driversUrlMatch.Success)
{
string chipsetPageContent = await this.client.GetStringAsync(driversUrlMatch.Value);
string chipsetUrlPattern = $@"https://[^\s""']*.exe";
string chipsetUrlPattern = $@"https://[^""]+\.exe";
Match chipsetUrlMatch = Regex.Match(chipsetPageContent, chipsetUrlPattern, RegexOptions.IgnoreCase);
if (chipsetUrlMatch.Success)
{
Expand Down
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyFileVersion("0.0.3.0")]

0 comments on commit 611cfd8

Please sign in to comment.