#Requires -Version 5.1
Set-StrictMode -Version Latest

$AppName    = "Cyclope"
$InstallDir = "$env:LOCALAPPDATA\Cyclope"

Write-Host "==> Desinstallation de $AppName"

# Arreter le processus
Stop-Process -Name "cyclope" -Force -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 500

# Supprimer la tache planifiee
Unregister-ScheduledTask -TaskName $AppName -TaskPath "\Privateer\" `
    -Confirm:$false -ErrorAction SilentlyContinue

# Supprimer la cle registry (si utilisee)
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" `
    -Name $AppName -ErrorAction SilentlyContinue

# Supprimer les raccourcis
Remove-Item "$env:USERPROFILE\Desktop\Cyclope.lnk" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Cyclope" `
    -Recurse -Force -ErrorAction SilentlyContinue

# Supprimer le binaire et les DLL
Remove-Item $InstallDir -Recurse -Force -ErrorAction SilentlyContinue

Write-Host "Cyclope desinstalle."
Write-Host "  Config conservee dans : $env:APPDATA\Cyclope\"
Write-Host "  Pour la supprimer : Remove-Item '$env:APPDATA\Cyclope' -Recurse"
