@echo off
echo.
echo *************************************************************************
echo ******************DolbyAccessOEM Installation [START1]******************
echo *************************************************************************
echo.


pushd "DolbyAccessOEM"


rem ==========Set License Name==========
for /r "%~dp0DolbyAccessOEM" %%G in (*.xml) do (
    set License1XML=%%~nxG
)

rem ============Set App Name============
set HSAppx=%License1XML:_License1.xml=%.msixbundle


rem ==========Set Dependencies==========
for /r "%~dp0DolbyAccessOEM" %%G in (*VCLibs*_x64_*) do ( 
	set VCLibAppx=%%~nxG
)
for /r "%~dp0DolbyAccessOEM" %%G in (*Framework*_x64_*) do (  
	set FmwkAppx=%%~nxG
)
for /r "%~dp0DolbyAccessOEM" %%G in (*Runtime*_x64_*) do ( 
	set RuntimeAppx=%%~nxG
)

for /r "%~dp0DolbyAccessOEM" %%G in (*Xaml*_x64_*) do ( 
	set XamlAppx=%%~nxG
)
for /r "%~dp0DolbyAccessOEM" %%G in (*VCLibs.140.00.UWPDesktop*_x64_*) do ( 
	set VCLibs.140.00.UWPDesktopAppx=%%~nxG
)

echo 1.   Application Name: %HSAppx%
echo 2.   License File: %License1XML%
echo 3.1. DepPkg_VCLibs: %VCLibAppx%
echo 3.2. DepPkg_Runtime: %RuntimeAppx%
echo 3.3. DepPkg_Framework: %FmwkAppx%

echo 3.5. DepPkg_Xaml: %XamlAppx%
echo 3.6. DepPkg_VCLibs.140.00.UWPDesktop: %VCLibs.140.00.UWPDesktopAppx%
echo.

rem ==========Install UWP App===========
dism /online /Add-ProvisionedAppxPackage /PackagePath:"%~dp0DolbyAccessOEM\%HSAppx%" /LicensePath:"%~dp0DolbyAccessOEM\%License1XML%" /DependencyPackagePath:"%~dp0DolbyAccessOEM\%RuntimeAppx%" /DependencyPackagePath:"%~dp0DolbyAccessOEM\%FmwkAppx%" /DependencyPackagePath:"%~dp0DolbyAccessOEM\%VCLibAppx%"  /Region="All"



echo.
echo *************************************************************************
echo *******************DolbyAccessOEM Installation [END]*******************
echo *************************************************************************
echo.






echo.
echo *************************************************************************
echo ******************DolbySettings Installation [START]******************
echo *************************************************************************
echo.


pushd "DolbySettings"



rem ==========Set License Name==========
for /r "%~dp0DolbySettings" %%G in (*.xml) do (
    set License1XML=%%~nxG
)

rem ============Set App Name============
set HSAppx=%License1XML:_License1.xml=%.msixbundle


rem ==========Set Dependencies==========
for /r "%~dp0DolbySettings" %%G in (*VCLibs*_x64_*) do ( 
	set VCLibAppx=%%~nxG
)
for /r "%~dp0DolbySettings" %%G in (*Framework*_x64_*) do (  
	set FmwkAppx=%%~nxG
)
for /r "%~dp0DolbySettings" %%G in (*Runtime*_x64_*) do ( 
	set RuntimeAppx=%%~nxG
)


for /r "%~dp0DolbySettings" %%G in (*Xaml*_x64_*) do ( 
	set XamlAppx=%%~nxG
)
for /r "%~dp0DolbySettings" %%G in (*VCLibs.140.00.UWPDesktop*_x64_*) do ( 
	set VCLibs.140.00.UWPDesktopAppx=%%~nxG
)

echo 1.   Application Name: %HSAppx%
echo 2.   License File: %License1XML%
echo 3.1. DepPkg_VCLibs: %VCLibAppx%
echo 3.2. DepPkg_Runtime: %RuntimeAppx%
echo 3.3. DepPkg_Framework: %FmwkAppx%

echo 3.5. DepPkg_Xaml: %XamlAppx%
echo 3.6. DepPkg_VCLibs.140.00.UWPDesktop: %VCLibs.140.00.UWPDesktopAppx%
echo.

rem ==========Install UWP App===========
dism /online /Add-ProvisionedAppxPackage /PackagePath:"%~dp0DolbySettings\%HSAppx%" /LicensePath:"%~dp0DolbySettings\%License1XML%" /DependencyPackagePath:"%~dp0DolbySettings\%VCLibAppx%" /DependencyPackagePath:"%~dp0DolbySettings\%RuntimeAppx%" /DependencyPackagePath:"%~dp0DolbySettings\%FmwkAppx%" /DependencyPackagePath:"%~dp0DolbySettings\%XamlAppx%" /DependencyPackagePath:"%~dp0DolbySettings\%VCLibs.140.00.UWPDesktopAppx%"  /Region="All"



echo.
echo *************************************************************************
echo *******************DolbySettings Installation [END]*******************
echo *************************************************************************
echo.
cd..