@@ -520,25 +520,31 @@ if (-not $noGui.IsPresent) {
520
520
$category = $_.SelectSingleNode (" m:properties/d:Tags" , $ns ).InnerText
521
521
# Select only packages that have the latest version, contain a category and the category is not excluded
522
522
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
- }
536
- }
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
+ $packageObject = [PSCustomObject ]@ {
532
+ PackageName = $packageName
533
+ PackageDescription = $description
534
+ }
535
+ # Check if $projectUrl contains a valid URL
536
+ if ($projectUrl -match " ^http" ) {
537
+ Add-Member - InputObject $packageObject - MemberType NoteProperty - Name " PackageUrl" - Value $projectURl
538
+ }
539
+ # Add the PackageName and PackageDescription (and PackageUrl if present) to each entry in the array
540
+ $packagesByCategory [$category ] += $packageObject
541
+ }
542
+ }
537
543
# Check if there is a next link in the XML and set the API URL to that link if it exists
538
544
$nextLink = $vm_packages.SelectSingleNode (" //atom:link[@rel='next']/@href" , $ns )
539
545
$vmPackagesUrl = $nextLink ." #text"
540
546
541
- } while ($vmPackagesUrl )
547
+ } while ($vmPackagesUrl )
542
548
543
549
return $packagesByCategory
544
550
}
@@ -794,11 +800,6 @@ if (-not $noGui.IsPresent) {
794
800
)
795
801
return $packagesByCategory [$category ]
796
802
}
797
- # Function that returns an array of all the packages that are displayed sorted by category from $packagesByCategory
798
- function Get-AllPackages {
799
- $listedPackages = $packagesByCategory.Values | ForEach-Object { $_ } | Select-Object - ExpandProperty PackageName
800
- return $listedPackages
801
- }
802
803
803
804
# Function that returns additional packages from the config that are not displayed in the textboxes
804
805
# which includes both Choco packages and packages from excluded categories
@@ -1003,6 +1004,20 @@ if (-not $noGui.IsPresent) {
1003
1004
$checkBox.Name = " checkBox$numCheckBoxPackages "
1004
1005
$checkboxesPackages.Add ($checkBox )
1005
1006
$panelCategories.Controls.Add ($checkBox )
1007
+ $url = $package.PackageUrl
1008
+ if ($url ){
1009
+ $linkProjectUrl = New-Object System.Windows.Forms.linkLabel
1010
+ $linkProjectUrl.Top = $checkbox.Top + 2
1011
+ $linkProjectUrl.Left = $checkbox.Right - 3
1012
+ $linkProjectUrl.AutoSize = $true
1013
+ $linkProjectUrl.Font = New-Object System.Drawing.Font(' Microsoft Sans Serif' , 10 )
1014
+ $linkProjectUrl.LinkColor = " BLUE" ;
1015
+ $linkProjectUrl.ActiveLinkColor = " RED"
1016
+ $linkProjectUrl.Text = " Link"
1017
+ $linkProjectUrl.Links.Add (0 , 4 , $url )| Out-Null
1018
+ $linkProjectUrl.add_Click ({ Start-Process $this.Links.LinkData })
1019
+ $panelCategories.Controls.Add ($linkProjectUrl )
1020
+ }
1006
1021
$verticalPosition2 += 20
1007
1022
$numCheckBoxPackages ++
1008
1023
}
@@ -1069,7 +1084,7 @@ if (-not $noGui.IsPresent) {
1069
1084
$linkLabelChoco.LinkColor = " BLUE"
1070
1085
$linkLabelChoco.ActiveLinkColor = " RED"
1071
1086
$linkLabelChoco.Text = " https://community.chocolatey.org/packages"
1072
- $linkLabelChoco.add_Click ({[ system.Diagnostics. Process]::start( " https://community.chocolatey.org/packages" ) })
1087
+ $linkLabelChoco.add_Click ({Start- Process " https://community.chocolatey.org/packages" })
1073
1088
1074
1089
$labelFlarevm = New-Object System.Windows.Forms.Label
1075
1090
$labelFlarevm.Location = New-Object System.Drawing.Point(300 , 680 )
@@ -1085,7 +1100,7 @@ if (-not $noGui.IsPresent) {
1085
1100
$linkLabelFlarevm.LinkColor = " BLUE"
1086
1101
$linkLabelFlarevm.ActiveLinkColor = " RED"
1087
1102
$linkLabelFlarevm.Text = " https://github.com/mandiant/VM-Packages/wiki/Packages"
1088
- $linkLabelFlarevm.add_Click ({[ system.Diagnostics. Process]::start( " https://github.com/mandiant/VM-Packages/wiki/Packages" ) })
1103
+ $linkLabelFlarevm.add_Click ({Start- Process " https://github.com/mandiant/VM-Packages/wiki/Packages" })
1089
1104
1090
1105
Set-AdditionalPackages
1091
1106
0 commit comments