#!/usr/bin/env bash
# Author: Castro Fidel
# type: games
# name: Indiegala Client
# image: igclient
# info_en: Launcher for the Indiegala game library.
# info_ru: Лаунчер для библиотеки игр Indiegala.
########################################################################
export LAUNCH_PARAMETERS="/S"
export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/igclient_setup.exe"
export PW_DLL_INSTALL="vcrun2019"

start_portproton
if try_download "https://content.indiegalacdn.com/common/IGClientSetup.exe" "${PW_AUTOINSTALL_EXE}" no_mirror
then
    pw_kill_autostart IGClient.exe 3 &
    pw_run "${PW_AUTOINSTALL_EXE}"
    PW_EXE_FILE="${WINEPREFIX}/drive_c/Program Files/IGClient/IGClient.exe"
    try_remove_file "${PW_AUTOINSTALL_EXE}"
    try_remove_file "${PW_EXE_FILE}.ppdb"
    kill_portwine
    export PORTWINE_CREATE_SHORTCUT_NAME="IGClient"
    portwine_create_shortcut
fi
stop_portproton
