# version format
version: 2.3-{build}

# pull request template
pull_requests:
  do_not_increment_build_number: true

# vm template
image: Visual Studio 2022

# environment variables
environment:
  EnableNuGetPackageRestore: true

# msbuild configuration
platform:
- Any CPU
configuration:
- Debug

# install dependencies
install:
- ps: appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive

# pre-build script
before_build:
- nuget restore

# build step
build:
  verbosity: minimal
  project: MPF.sln

# post-build step
after_build:
- ps: appveyor DownloadFile https://github.com/aaru-dps/Aaru/releases/download/v5.3.1/aaru-5.3.1_windows_x64.zip
- ps: appveyor DownloadFile http://www.chrysocome.net/downloads/8ab730cd2a29e76ddd89be1f99357942/dd-0.6beta3.zip
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/9536254/DiscImageCreator_20220909.zip
- ps: appveyor DownloadFile https://github.com/superg/redumper/releases/download/build_51/redumper-2022.09.26_build51-win64.zip
- ps: appveyor DownloadFile https://archive.org/download/subdump_fua_0x28/subdump_fua_0x28.zip

- 7z x aaru-5.3.1_windows_x64.zip -oMPF\bin\Debug\net48\Programs\Aaru *
#- 7z x aaru-5.3.1_windows_x64.zip -oMPF\bin\Debug\net6.0\Programs\Aaru *

- 7z e dd-0.6beta3.zip -oMPF\bin\Debug\net48\Programs\DD *
#- 7z e dd-0.6beta3.zip -oMPF\bin\Debug\net6.0\Programs\DD *

- 7z e DiscImageCreator_20220909.zip -oMPF\bin\Debug\net48\Programs\Creator Release_ANSI\*
#- 7z e DiscImageCreator_20220909.zip -oMPF\bin\Debug\net6.0\Programs\Creator Release_ANSI\*

- 7z e redumper-2022.09.26_build51-win64.zip -oMPF\bin\Debug\net48\Programs\Redumper redumper-2022.09.26_build51-win64\bin\*
#- 7z e redumper-2022.09.26_build51-win64.zip -oMPF\bin\Debug\net6.0\Programs\Redumper redumper-2022.09.26_build51-win64\bin\*

- 7z e subdump_fua_0x28.zip -oMPF\bin\Debug\net48 *
- mkdir MPF\bin\Debug\net48\Programs\Subdump
- mv MPF\bin\Debug\net48\subdump_fua_0x28.exe MPF\bin\Debug\net48\Programs\Subdump\subdump.exe
#- 7z e subdump_fua_0x28.zip -oMPF\bin\Debug\net6.0 *
#- mkdir MPF\bin\Debug\net6.0\Programs\Subdump
#- mv MPF\bin\Debug\net6.0\subdump_fua_0x28.exe MPF\bin\Debug\net6.0\Programs\Subdump\subdump.exe

- cd MPF\bin\Debug
- 7z a MPF_net48.zip net48\*
#- 7z a MPF_net6.0.zip net6.0\*

- cd ..\..\..\MPF.Check\bin\Debug
- 7z a MPF-Check_net48.zip net48\*
#- 7z a MPF-Check_net6.0.zip net6.0\*

# success/failure tracking
on_success:
  - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
  - ps: ./send.ps1 success $env:WEBHOOK_URL
on_failure:
  - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
  - ps: ./send.ps1 failure $env:WEBHOOK_URL

# artifact linking
artifacts:
- path: MPF\bin\Debug\MPF_net48.zip
  name: MPF (WPF UI) (.NET Framework 4.8)
#- path: MPF\bin\Debug\MPF_net6.0.zip
#  name: MPF (WPF UI) (.NET 6.0)

- path: MPF.Check\bin\Debug\MPF-Check_net48.zip
  name: MPF Check (.NET Framework 4.8)
#- path: MPF.Check\bin\Debug\MPF-Check_net6.0.zip
#  name: MPF Check (.NET 6.0)