@echo on
@setlocal
@set this=%~dp0
@set thisn=%~nx0
@set name=AddOnStudio
@set namel=AddOn Studio
@set edition=2022
@set shellname=Visual Studio
@set shellver=17.10 LTSC
@set stubname=VisualStudioSetupCommunity
@set stubdl=https://files.fallenworlds.org/_as/_26SAR5/VisualStudioSetup_2022_Community_220315.exe
@set stubch=https://aka.ms/vs/17/release.LTSC.17.10/channel

@echo.
@REM echo %shellname% Community (stable version) installation for %namel% 2022
@echo.
@echo This will install %shellname% %edition% LTSC for %name%
@echo.
@echo Current preferred version is %shellname% %edition% %shellver% (Long Term Support Channel) 
@echo.
@echo Can uninstall any current %shellname% first, or install this along side your existing one.
@echo If use Pro or Enterpise and would rather, choose appropriate LTSC 17.10 here:
@echo    https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history
@echo.
@echo Click close or press Ctrl-C to abort.
@pause

@if not exist "%SystemRoot%\System32\curl.exe" GOTO NOTHASCURL
@if not exist %LOCALAPPDATA%\Temp goto NOTHASTEMP

@echo Download stub...
@if exist "%LOCALAPPDATA%\Temp\%stubname%.exe" goto HASSTUB
@curl.exe -o "%LOCALAPPDATA%\Temp\%stubname%.exe" %stubdl%
@echo %ERRORLEVEL%
@if "%ERRORLEVEL%" NEQ "0" goto NOTHASDL
:HASSTUB
@echo Has Stub...


@echo Install stub...
@"%LOCALAPPDATA%\Temp\%stubname%.exe" --channelUri %stubch%

@GOTO :EOF

:NOTHASDL
@echo Error: Could not download installer stub.
@GOTO :EOF
:NOTHASCURL
:NOTHASTEMP
@echo Error: This script requires Windows 10 or higher.
@GOTO :EOF

