From d5f5c333de7233e9e53f2be62d5e61f08a7ca6fc Mon Sep 17 00:00:00 2001
From: d35ha <d35hax@gmail.com>
Date: Wed, 24 Jul 2024 07:48:04 +0000
Subject: [PATCH] Switch to ImHex NoGPU

---
 packages/imhex.vm/imhex.vm.nuspec               |  1 -
 packages/imhex.vm/tools/chocolateyinstall.ps1   | 17 +++++------------
 packages/imhex.vm/tools/chocolateyuninstall.ps1 |  3 +--
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/packages/imhex.vm/imhex.vm.nuspec b/packages/imhex.vm/imhex.vm.nuspec
index 9c21c1987..c6a0a4039 100644
--- a/packages/imhex.vm/imhex.vm.nuspec
+++ b/packages/imhex.vm/imhex.vm.nuspec
@@ -7,7 +7,6 @@
     <description>A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.</description>
     <dependencies>
       <dependency id="common.vm" />
-      <dependency id="imhex" version="[1.35.4]" />
     </dependencies>
   </metadata>
 </package>
\ No newline at end of file
diff --git a/packages/imhex.vm/tools/chocolateyinstall.ps1 b/packages/imhex.vm/tools/chocolateyinstall.ps1
index 765f1abca..227090ba1 100644
--- a/packages/imhex.vm/tools/chocolateyinstall.ps1
+++ b/packages/imhex.vm/tools/chocolateyinstall.ps1
@@ -1,17 +1,10 @@
 $ErrorActionPreference = 'Stop'
 Import-Module vm.common -Force -DisableNameChecking
 
-try {
-    $toolName = 'ImHex'
-    $category = 'Hex Editors'
+$toolName = 'ImHex'
+$category = 'Hex Editors'
 
-    $shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
-    $shortcut = Join-Path $shortcutDir "$toolName.lnk"
-    $executablePath = Join-Path ${Env:ChocolateyInstall} "bin\imhex.exe" -Resolve
-    Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath
-    VM-Assert-Path $shortcut
+$zipUrl = 'https://github.com/WerWolv/ImHex/releases/download/v1.35.4/imhex-1.35.4-Windows-Portable-NoGPU-x86_64.zip'
+$zipSha256 = '9b5dcf1cf649e20ad0837554aa050c8d72e902b932dacecb45e58fa7e5e3f85d'
 
-    VM-Add-To-Right-Click-Menu $toolName $toolName "`"$executablePath`" `"%1`"" "$executablePath"
-} catch {
-    VM-Write-Log-Exception $_
-}
\ No newline at end of file
+VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256
\ No newline at end of file
diff --git a/packages/imhex.vm/tools/chocolateyuninstall.ps1 b/packages/imhex.vm/tools/chocolateyuninstall.ps1
index 499e5cf17..c4421f8b1 100644
--- a/packages/imhex.vm/tools/chocolateyuninstall.ps1
+++ b/packages/imhex.vm/tools/chocolateyuninstall.ps1
@@ -4,5 +4,4 @@ Import-Module vm.common -Force -DisableNameChecking
 $toolName = 'ImHex'
 $category = 'Hex Editors'
 
-VM-Remove-Tool-Shortcut $toolName $category
-VM-Remove-From-Right-Click-Menu $toolName
\ No newline at end of file
+VM-Uninstall $toolName $category
\ No newline at end of file