Skip to content

Commit

Permalink
Simplify VM-Remove-From-Right-Click-Menu
Browse files Browse the repository at this point in the history
Give `type` a default value as it is `file` in most of the cases to
simplify the code.
  • Loading branch information
Ana06 committed Sep 26, 2023
1 parent 0c609a8 commit 1f91b37
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/common.vm/common.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>common.vm</id>
<version>0.0.0.20230714</version>
<version>0.0.0.20230925</version>
<description>Common libraries for VM-packages</description>
<authors>Mandiant</authors>
</metadata>
Expand Down
10 changes: 5 additions & 5 deletions packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,11 @@ function VM-Add-To-Right-Click-Menu {
[string] $menuLabel, # value displayed in right-click menu
[Parameter(Mandatory=$true, Position=2)]
[string] $command,
[Parameter(Mandatory=$true, Position=3)]
[Parameter(Mandatory=$false, Position=3)]
[string] $menuIcon,
[Parameter(Mandatory=$false)]
[ValidateSet("file", "directory")]
[string] $type,
[Parameter(Mandatory=$false, Position=4)]
[string] $menuIcon
[string] $type="file"
)
try {
# Determine if file or directory should show item in right-click menu
Expand Down Expand Up @@ -740,7 +740,7 @@ function VM-Remove-From-Right-Click-Menu {
[String] $menuKey, # name of registry key
[Parameter(Mandatory=$true, Position=1)]
[ValidateSet("file", "directory")]
[string] $type
[string] $type="file"
)
try {
# Determine if file or directory should show item in right-click menu
Expand Down
4 changes: 2 additions & 2 deletions packages/die.vm/die.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>die.vm</id>
<version>3.07.20230523</version>
<version>3.07.20230925</version>
<authors>Hellsp@wn, horsicq</authors>
<description>Detect It Easy, or abbreviated "DIE" is a program for determining types of files.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="common.vm" version="0.0.0.20230925" />
</dependencies>
</metadata>
</package>
2 changes: 1 addition & 1 deletion packages/die.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ try {
$zipSha256_64 = '3450169643be76484ac4bd5e1473f6f4745d9825c8a07255a3925a4a6e8bad7e'

$executablePath = (VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -zipUrl_64 $zipUrl_64 -zipSha256_64 $zipSha256_64)[-1]
VM-Add-To-Right-Click-Menu $toolName "detect it easy (DIE)" "`"$executablePath`" `"%1`"" "file" "$executablePath"
VM-Add-To-Right-Click-Menu $toolName "detect it easy (DIE)" "`"$executablePath`" `"%1`"" "$executablePath"
} catch {
VM-Write-Log-Exception $_
}
2 changes: 1 addition & 1 deletion packages/die.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ $toolName = 'die'
$category = 'Utilities'

VM-Uninstall $toolName $category
VM-Remove-From-Right-Click-Menu $toolName "file"
VM-Remove-From-Right-Click-Menu $toolName
4 changes: 2 additions & 2 deletions packages/explorersuite.vm/explorersuite.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>explorersuite.vm</id>
<version>0.0.0.20230523</version>
<version>0.0.0.20230925</version>
<authors>Erik Pistelli</authors>
<description>A suite of tools including CFF Explorer and a process viewer.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="common.vm" version="0.0.0.20230925" />
</dependencies>
</metadata>
</package>
2 changes: 1 addition & 1 deletion packages/explorersuite.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ try {
# "Open with CFF Explorer" is added to the registry for several extensions,
# add it for all extension with same key to avoid duplication.
# Use same label and no icon to make it look the same for all extensions.
VM-Add-To-Right-Click-Menu 'Open with CFF Explorer' 'Open with CFF Explorer' "`"$cffExplorerExecutablePath`" %1" "file"
VM-Add-To-Right-Click-Menu 'Open with CFF Explorer' 'Open with CFF Explorer' "`"$cffExplorerExecutablePath`" %1"
} catch {
VM-Write-Log-Exception $_
}
2 changes: 1 addition & 1 deletion packages/explorersuite.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ foreach ($subtoolName in $subtoolNames) {
VM-Remove-Tool-Shortcut $subtoolName $category
}

VM-Remove-From-Right-Click-Menu 'CFF explorer' "file"
VM-Remove-From-Right-Click-Menu 'CFF explorer'

VM-Uninstall-With-Uninstaller "Explorer Suite IV" "EXE" "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-"
4 changes: 2 additions & 2 deletions packages/file.vm/file.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>file.vm</id>
<version>0.0.0.20170108</version>
<version>0.0.0.20230925</version>
<description>A Windows port of the Linux `file` utility for checking header magics</description>
<authors>Nolen Scaiffe</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="common.vm" version="0.0.0.20230925" />
</dependencies>
</metadata>
</package>
2 changes: 1 addition & 1 deletion packages/file.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try {
$scriptPath = Join-Path $executableDir "leave_file_open.bat"
[IO.File]::WriteAllLines($scriptPath, $("`"$executablePath`" %1", "PAUSE"))

VM-Add-To-Right-Click-Menu $toolName "file type" "`"$scriptPath`" `"%1`"" "file"
VM-Add-To-Right-Click-Menu $toolName "file type" "`"$scriptPath`" `"%1`""
} catch {
VM-Write-Log-Exception $_
}
2 changes: 1 addition & 1 deletion packages/file.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ $toolName = 'file'
$category = 'Utilities'

VM-Uninstall $toolName $category
VM-Remove-From-Right-Click-Menu $toolName "file"
VM-Remove-From-Right-Click-Menu $toolName
4 changes: 2 additions & 2 deletions packages/hashmyfiles.vm/hashmyfiles.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>hashmyfiles.vm</id>
<version>0.0.0.20230524</version>
<version>0.0.0.20230925</version>
<description>HashMyFiles is small utility that allows you to calculate the MD5 and SHA1 hashes of one or more files in your system. You can easily copy the MD5/SHA1 hashes list into the clipboard, or save them into text/html/xml file.</description>
<authors>Nir Sofer</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="common.vm" version="0.0.0.20230925" />
</dependencies>
</metadata>
</package>
4 changes: 2 additions & 2 deletions packages/hashmyfiles.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ try {
$zipUrl_64 = "https://www.nirsoft.net/utils/hashmyfiles-x64.zip"

$executablePath = (VM-Install-From-Zip $toolName $category $zipUrl -zipUrl_64 $zipUrl_64)[-1]
VM-Add-To-Right-Click-Menu $toolName "HashMyFiles" "`"$executablePath`" /file `"%1`"" "file" "$executablePath"
VM-Add-To-Right-Click-Menu $toolName "HashMyFiles" "`"$executablePath`" /file `"%1`"" "directory" "$executablePath"
VM-Add-To-Right-Click-Menu $toolName "HashMyFiles" "`"$executablePath`" /file `"%1`"" "$executablePath"
VM-Add-To-Right-Click-Menu $toolName "HashMyFiles" "`"$executablePath`" /file `"%1`"" "$executablePath" -type "directory"
} catch {
VM-Write-Log-Exception $_
}
4 changes: 2 additions & 2 deletions packages/hashmyfiles.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ $toolName = 'hashmyfiles'
$category = 'Utilities'

VM-Uninstall $toolName $category
VM-Remove-From-Right-Click-Menu $toolName "file"
VM-Remove-From-Right-Click-Menu $toolName "directory"
VM-Remove-From-Right-Click-Menu $toolName
VM-Remove-From-Right-Click-Menu $toolName -type "directory"
4 changes: 2 additions & 2 deletions packages/hxd.vm/hxd.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>hxd.vm</id>
<version>2.5.0.20230524</version>
<version>2.5.0.20230925</version>
<authors>Maël Hörz</authors>
<description>Freeware hex editor</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="common.vm" version="0.0.0.20230925" />
<dependency id="hxd" version="[2.5.0.0]" />
</dependencies>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion packages/hxd.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try {

Install-BinFile -Name $toolName -Path $executablePath

VM-Add-To-Right-Click-Menu $toolName $toolName "`"$executablePath`" `"%1`"" "file" "$executablePath"
VM-Add-To-Right-Click-Menu $toolName $toolName "`"$executablePath`" `"%1`"" "$executablePath"
} catch {
VM-Write-Log-Exception $_
}
Expand Down
2 changes: 1 addition & 1 deletion packages/hxd.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ $toolName = 'HxD'
$category = 'Hex Editors'

VM-Remove-Tool-Shortcut $toolName $category
VM-Remove-From-Right-Click-Menu $toolName "file"
VM-Remove-From-Right-Click-Menu $toolName
Uninstall-BinFile -Name $toolName

0 comments on commit 1f91b37

Please sign in to comment.