set windows_files_path=..\..\..\Product\flyinsono\windows_files
set windows_setup_path=..\..\..\Product\flyinsono\fiswinsetup
set pc_full_client_win=..\..\..\Product\flyinsono\pc_full_client_win
set windows_installer_path=..\..\..\Product\flyinsono\windows
set vsigntool_path=C:\Users\IUS\AppData\Local\Programs\vsigntoolui\binaries
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=mobile\flyinsono.apk /cd=android\flyinsono.apk
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=mobile\flyinsono.aab /cd=android\flyinsono.aab
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=mobile\flyinsono_addhoc.ipa /cd=ios\flyinsono_addhoc.ipa
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=mobile\flyinsono_appstore.ipa /cd=ios\flyinsono_appstore.ipa
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=web\flyinsono.zip /cd=web /unzip=true
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=web\flyinsono.zip /cd=osx_files\App\flyinsono\flyinsono.zip
PackTool /mode=copy /pn=flyinsono /rn=Flyinsono /rs=web\flyinsono.zip /cd=windows_files\App\flyinsono\flyinsono.zip
PackTool /mode=copy /pn=flyinsono /rn=WingManagementModule /rs=ManagementReportDesignerApp.zip /cd=windows_files\App\flyinsono\ManagementReportDesignerApp.zip
PackTool /mode=version /pn=flyinsono /rn=Flyinsono /rv=%1
xcopy /y /c /k "..\..\..\Product\flyinsono\Versions.txt" "..\..\..\Product\flyinsono\windows_files\"

REM This is some scripts to do code singature
%vsigntool_path%/vsigntool --config C:\Users\IUS\AppData\Roaming\vsigntoolui/config.xml --cmd sign -i %windows_files_path%\fis.exe -m 3 -r FlyinsonoClient
%vsigntool_path%/vsigntool --config C:\Users\IUS\AppData\Roaming\vsigntoolui/config.xml --cmd sign -i %windows_files_path%\fis.Upgrader.exe -m 3 -r FlyinsonoClient
%vsigntool_path%/vsigntool --config C:\Users\IUS\AppData\Roaming\vsigntoolui/config.xml --cmd sign -i %windows_setup_path%\extra\loader.exe -m 3 -r FlyinsonoClient

REM This is some scripts to pick for dedicated files to minus package size
if not exist %pc_full_client_win% mkdir %pc_full_client_win%

if not exist "%pc_full_client_win%\App" mkdir "%pc_full_client_win%\App"
xcopy /y /h /s "%windows_files_path%\App\*" "%pc_full_client_win%\App"

if not exist "%pc_full_client_win%\CefGlueBrowserProcess" mkdir "%pc_full_client_win%\CefGlueBrowserProcess"
copy /y "%windows_files_path%\CefGlueBrowserProcess\Xilium.CefGlue.BrowserProcess.exe" "%pc_full_client_win%\CefGlueBrowserProcess"

if not exist "%pc_full_client_win%\locales" mkdir "%pc_full_client_win%\locales"
copy /y "%windows_files_path%\locales\en-US.pak" "%pc_full_client_win%\locales"
copy /y "%windows_files_path%\locales\zh-CN.pak" "%pc_full_client_win%\locales"
copy /y "%windows_files_path%\locales\zh-TW.pak" "%pc_full_client_win%\locales"
copy /y "%windows_files_path%\locales\ru.pak" "%pc_full_client_win%\locales"

if not exist "%pc_full_client_win%\SmartPublisher" mkdir "%pc_full_client_win%\SmartPublisher"
xcopy /y /h /s "%windows_files_path%\SmartPublisher\*" "%pc_full_client_win%\SmartPublisher"

if not exist "%pc_full_client_win%\swiftshader" mkdir "%pc_full_client_win%\swiftshader"
xcopy /y /h /s "%windows_files_path%\swiftshader\*" "%pc_full_client_win%\swiftshader"


copy /y "%windows_files_path%\cef.pak" "%pc_full_client_win%"
copy /y "%windows_files_path%\FisPrintDrive.exe" "%pc_full_client_win%"
copy /y "%windows_files_path%\cef_100_percent.pak" "%pc_full_client_win%"
copy /y "%windows_files_path%\cef_200_percent.pak" "%pc_full_client_win%"
copy /y "%windows_files_path%\cef_extensions.pak" "%pc_full_client_win%"
copy /y "%windows_files_path%\chrome_elf.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\concrt140.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\cvextern.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\d3dcompiler_47.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\devtools_resources.pak" "%pc_full_client_win%"
copy /y "%windows_files_path%\fis.exe" "%pc_full_client_win%"
copy /y "%windows_files_path%\fis.Upgrader.exe" "%pc_full_client_win%"
copy /y "%windows_files_path%\flyinsono.ico" "%pc_full_client_win%"
copy /y "%windows_files_path%\icudtl.dat" "%pc_full_client_win%"
copy /y "%windows_files_path%\libcef.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\libEGL.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\libGLESv2.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\libHarfBuzzSharp.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\libSkiaSharp.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\msvcp140.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\msvcp140_1.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\msvcp140_2.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\msvcp140_atomic_wait.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\msvcp140_codecvt_ids.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\snapshot_blob.bin" "%pc_full_client_win%"
copy /y "%windows_files_path%\v8_context_snapshot.bin" "%pc_full_client_win%"
copy /y "%windows_files_path%\vcruntime140.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\vcruntime140_1.dll" "%pc_full_client_win%"
copy /y "%windows_files_path%\resources.pak" "%pc_full_client_win%"
copy /y "%windows_files_path%\Versions.txt" "%pc_full_client_win%"
copy /y "%windows_setup_path%\extra\loader.exe" "%pc_full_client_win%"

REM End to pick for dedicated files to minus package size
PackTool /mode=inno /pn=flyinsono /pv=2.0.0.0 /ss=windows_files /od=windows /iss=fiswinsetup\flyinsono.iss
%vsigntool_path%/vsigntool --config C:\Users\IUS\AppData\Roaming\vsigntoolui/config.xml --cmd sign -i %windows_installer_path%\flyinsono.exe -m 3 -r FlyinsonoClient
PackTool /mode=repack /pn=flyinsono /ef=osx_files,windows_files