Skip to content

Commit

Permalink
Merge pull request #234 from TheCakeIsNaOH/crystaldisk
Browse files Browse the repository at this point in the history
(crystaldiskinfo) fix AU script for install and portable
  • Loading branch information
mkevenaar committed Mar 31, 2024
2 parents b894089 + 23bf646 commit cc1cda5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
12 changes: 4 additions & 8 deletions automatic/crystaldiskinfo.install/update.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
Import-Module Chocolatey-AU

$releases = 'https://crystalmark.info/redirect.php?product=CrystalDiskInfoInstaller'
$feed = 'https://osdn.net/projects/crystaldiskinfo/releases/rss'
$downloads = 'https://sourceforge.net/projects/crystaldiskinfo/rss?path=/'

function global:au_BeforeUpdate { Get-RemoteFiles -NoSuffix -Purge }
function global:au_BeforeUpdate { Get-RemoteFiles -NoSuffix -Purge -FileNameSkip 1 }

function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $feed -UseBasicParsing
$feed = ([xml]$download_page.Content).rss.channel
$download_page = Invoke-WebRequest -Uri $downloads -UseBasicParsing

$re = "CrystalDiskInfo([_0-9]+(RC\d+)?)\.exe"

$url = ($feed.item[0].files.file | where-object "#text" -Match $re | Sort-Object url -Descending | Select-Object -First 1).url -Replace "https://osdn.net/projects/crystaldiskinfo/downloads/", "https://osdn.net/frs/redir.php?m=dotsrc&f=crystaldiskinfo/" -Replace "/$"

$url = Get-RedirectedUrl $url
$url = ([xml]$download_page.Content).rss.channel.item | Where-Object link -match $re | Select-Object -First 1 -ExpandProperty link

$version = (([regex]::Match($url,$re)).Captures.Groups[1].value) -Replace "_", "."
$version = Get-Version($version)
Expand Down
16 changes: 6 additions & 10 deletions automatic/crystaldiskinfo.portable/update.ps1
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
Import-Module Chocolatey-AU

$releases = 'https://crystalmark.info/redirect.php?product=CrystalDiskInfoInstaller'
$feed = 'https://osdn.net/projects/crystaldiskinfo/releases/rss'
$downloads = 'https://sourceforge.net/projects/crystaldiskinfo/rss?path=/'

function global:au_BeforeUpdate { Get-RemoteFiles -NoSuffix -Purge }
function global:au_BeforeUpdate { Get-RemoteFiles -NoSuffix -Purge -FileNameSkip 1 }

function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $feed -UseBasicParsing
$feed = ([xml]$download_page.Content).rss.channel

$download_page = Invoke-WebRequest -Uri $downloads -UseBasicParsing

$re = "CrystalDiskInfo([_0-9]+(RC\d+)?)\.zip"
$url = ([xml]$download_page.Content).rss.channel.item | Where-Object link -match $re | Select-Object -First 1 -ExpandProperty link

$url = ($feed.item[0].files.file | where-object "#text" -Match $re | Sort-Object url -Descending | Select-Object -First 1).url -Replace "https://osdn.net/projects/crystaldiskinfo/downloads/", "https://osdn.net/frs/redir.php?m=dotsrc&f=crystaldiskinfo/" -Replace "/$"

$url = Get-RedirectedUrl $url

$version = (([regex]::Match($url,$re)).Captures.Groups[1].value) -Replace "_", "." -Replace "RC", "-RC"
$version = (([regex]::Match($url,$re)).Captures.Groups[1].value) -Replace "_", "."
$version = Get-Version($version)

return @{
Expand Down

0 comments on commit cc1cda5

Please sign in to comment.