$ErrorActionPreference = 'Stop'
$source = Split-Path -Parent $MyInvocation.MyCommand.Path
$install = Join-Path $env:LOCALAPPDATA 'GPT3D'
New-Item -ItemType Directory -Force -Path $install | Out-Null
Copy-Item -Path (Join-Path $source '*') -Destination $install -Recurse -Force
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut((Join-Path ([Environment]::GetFolderPath('Desktop')) 'Visualizador 3D APP.lnk'))
$shortcut.TargetPath = Join-Path $install 'Visualizador 3D APP.exe'
$shortcut.WorkingDirectory = $install
$shortcut.Description = 'Visualizador 3D para Windows APP - Agência Primeira Página'
$shortcut.IconLocation = (Join-Path (Join-Path (Join-Path $install 'app') 'assets') 'visualizador3dapp.ico') + ',0'
$shortcut.Save()
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show('Visualizador 3D APP has been installed. A shortcut was created on your desktop.','Installation complete') | Out-Null
