Skip to content

Commit d6a1557

Browse files
committed
Add projectUrl at the end of the description in the package selection
Add ProjectUrl if it contains a valid URL to the package selection window
1 parent c63b0f6 commit d6a1557

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

install.ps1

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -520,19 +520,28 @@ if (-not $noGui.IsPresent) {
520520
$category = $_.SelectSingleNode("m:properties/d:Tags", $ns).InnerText
521521
# Select only packages that have the latest version, contain a category and the category is not excluded
522522
if (($isLatestVersion -eq "true") -and ($category -ne "") -and ($excludedCategories -notcontains $category)) {
523-
$packageName = $_.properties.Id
524-
$description = $_.properties.Description
525-
526-
# Initialize category as an empty array
527-
if (-not ($packagesByCategory.ContainsKey($category))) {
528-
$packagesByCategory[$category] = @()
529-
}
530-
# Add the PackageName and PackageDesccription to each entry in the array
531-
$packagesByCategory[$category] += [PSCustomObject]@{
532-
PackageName = $packageName
533-
PackageDescription = $description
534-
}
535-
}
523+
$packageName = $_.properties.Id
524+
$description = $_.properties.Description
525+
$projectUrl = $_.properties.projectUrl
526+
527+
# Initialize category as an empty array
528+
if (-not ($packagesByCategory.ContainsKey($category))) {
529+
$packagesByCategory[$category] = @()
530+
}
531+
# Check if $projectUrl contains a valid URL
532+
if ($projectUrl -match "^http") {
533+
$packageObject = [PSCustomObject]@{
534+
PackageName = $packageName
535+
PackageDescription = $description
536+
PackageUrl = $projectUrl}
537+
}else{
538+
$packageObject = [PSCustomObject]@{
539+
PackageName = $packageName
540+
PackageDescription = $description}
541+
}
542+
# Add the PackageName and PackageDescription (and PackageUrl if present) to each entry in the array
543+
$packagesByCategory[$category] += $packageObject
544+
}
536545
}
537546
# Check if there is a next link in the XML and set the API URL to that link if it exists
538547
$nextLink = $vm_packages.SelectSingleNode("//atom:link[@rel='next']/@href", $ns)
@@ -1003,6 +1012,23 @@ if (-not $noGui.IsPresent) {
10031012
$checkBox.Name = "checkBox$numCheckBoxPackages"
10041013
$checkboxesPackages.Add($checkBox)
10051014
$panelCategories.Controls.Add($checkBox)
1015+
$url = $package.PackageUrl
1016+
if ($url){
1017+
$linkProjectUrl = New-Object System.Windows.Forms.linkLabel
1018+
$linkProjectUrl.Top = $checkbox.Top + 2
1019+
$linkProjectUrl.Left = $checkbox.Right - 3
1020+
$linkProjectUrl.AutoSize = $true
1021+
$linkProjectUrl.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
1022+
$linkProjectUrl.LinkColor = "BLUE";
1023+
$linkProjectUrl.ActiveLinkColor = "RED"
1024+
$linkProjectUrl.Text = $url
1025+
# Create a temporary, local variable with the correct URL for this specific link.
1026+
$linkProjectUrl.add_Click({
1027+
$tempUrl = $this.Text
1028+
[system.Diagnostics.Process]::start($tempUrl)
1029+
})
1030+
$panelCategories.Controls.Add($linkProjectUrl)
1031+
}
10061032
$verticalPosition2 += 20
10071033
$numCheckBoxPackages ++
10081034
}

0 commit comments

Comments
 (0)