File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Type : PackageTask
2+ WinGetIdentifier : NDI.NDIRuntime
3+ Skip : false
Original file line number Diff line number Diff line change 1+ $Object1 = Invoke-RestMethod - Uri ' https://downloads.ndi.tv/Tools/ndi_tools_win_current_version.json'
2+
3+ # Version
4+ $this.CurrentState.Version = $Object1.version
5+
6+ # Installer
7+ $this.CurrentState.Installer += [ordered ]@ {
8+ InstallerUrl = " https://downloads.ndi.tv/SDK/NDI_SDK/NDI $ ( $this.CurrentState.Version.Split (' .' )[0 ]) Runtime.exe"
9+ }
10+
11+ switch - Regex ($this.Check ()) {
12+ ' New|Changed|Updated' {
13+ try {
14+ $Object2 = Invoke-WebRequest - Uri ' https://docs.ndi.video/all/using-ndi/ndi-tools/release-notes' | ConvertFrom-Html
15+
16+ $ReleaseNotesTitleNode = $Object2.SelectSingleNode (" //h2[contains(., '$ ( $this.CurrentState.Version.Split (' .' )[0 .. 2 ] -join ' .' ) ')]" )
17+ if ($ReleaseNotesTitleNode ) {
18+ # Remove pseudo nodes
19+ $Object2.SelectNodes (" //li/div[contains(.//@style, `" pseudoBefore`" )]" ).ForEach ({ $_.Remove () })
20+
21+ # ReleaseNotes (en-US)
22+ $ReleaseNotesNodes = for ($Node = $ReleaseNotesTitleNode.NextSibling ; $Node -and $Node.Name -ne ' h2' ; $Node = $Node.NextSibling ) { $Node }
23+ $this.CurrentState.Locale += [ordered ]@ {
24+ Locale = ' en-US'
25+ Key = ' ReleaseNotes'
26+ Value = $ReleaseNotesNodes | Get-TextContent | Format-Text
27+ }
28+ } else {
29+ $this.Log (" No ReleaseNotes (en-US) for version $ ( $this.CurrentState.Version ) " , ' Warning' )
30+ }
31+ } catch {
32+ $_ | Out-Host
33+ $this.Log ($_ , ' Warning' )
34+ }
35+
36+ $this.Print ()
37+ $this.Write ()
38+ }
39+ ' Changed|Updated' {
40+ $this.Message ()
41+ }
42+ ' Updated' {
43+ $this.Submit ()
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments