diff --git a/Start.bat b/Start.bat index abb69ff..ddb6e4a 100644 --- a/Start.bat +++ b/Start.bat @@ -21,14 +21,13 @@ pushd %scriptPath% if not exist "Logs\" mkdir "Logs" +set init=0 set update=0 -if "%1" equ "/U" set update=1 -if "%1" equ "/u" set update=1 -if "%1" equ "-U" set update=1 -if "%1" equ "-u" set update=1 -if "%1" equ "--update" set update=1 -@REM powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 %update% -powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 %update% > Logs\%filename% +for %%a in (%*) do if /i "%%~a" equ "/I" set init=1 +for %%a in (%*) do if /i "%%~a" equ "/U" set update=1 + +@REM powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 -Init %init% -Update %update% +powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 -Init %init% -Update %update% > Logs\%filename% popd diff --git a/wDayzManager.ps1 b/wDayzManager.ps1 index c3bb5ae..ff3f55a 100644 --- a/wDayzManager.ps1 +++ b/wDayzManager.ps1 @@ -5,11 +5,15 @@ # Installation: Install-Module -Name PsIni [CmdletBinding()] -param ( - [Parameter()] - [int]$param = 0 +Param ( + [Alias("Init")] + [int]$param0 = $(throw "ERROR!!! Required parameter '-Init' is missing!"), + + [Alias("Update")] + [int]$param1 = $(throw "ERROR!!! Required parameter '-Update' is missing!") ) -[bool]$update = $param +[bool]$init = $param0 +[bool]$update = $param1 ######################################################################### [ CONFIG ] ########################################################################## @@ -90,7 +94,7 @@ $date = Get-Date $date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' } Write-Host "$($date2) Starting $($myName) $($myVersion) script" -Write-Host "update = $($update), noDelete = $($noDelete)" +Write-Host "init = $($init), update = $($update), noDelete = $($noDelete)" $ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null $modNI = $modNS = $namalskMission = $pathNamalskMission = $null @@ -117,6 +121,14 @@ $config = $ini.Config [string]$updatePeriod = $config.updatePeriod [bool]$rotateLogs = [int]$config.rotateLogs +function Init { + +} + +function Update { + +} + $clientMods = New-Object 'Collections.Generic.List[Tuple[string,string]]' foreach ($mod in $ini.ClientMods.GetEnumerator()) { if ($mod.Key -notlike "Comment*" ) {