Added "Init" parameter for future use.

This commit is contained in:
2024-12-24 12:40:00 +03:00
parent baefe7b866
commit 046b156396
2 changed files with 23 additions and 12 deletions

View File

@@ -21,14 +21,13 @@ pushd %scriptPath%
if not exist "Logs\" mkdir "Logs" if not exist "Logs\" mkdir "Logs"
set init=0
set update=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% for %%a in (%*) do if /i "%%~a" equ "/I" set init=1
powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 %update% > Logs\%filename% 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 popd

View File

@@ -5,11 +5,15 @@
# Installation: Install-Module -Name PsIni # Installation: Install-Module -Name PsIni
[CmdletBinding()] [CmdletBinding()]
param ( Param (
[Parameter()] [Alias("Init")]
[int]$param = 0 [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 ] ########################################################################## ######################################################################### [ CONFIG ] ##########################################################################
@@ -90,7 +94,7 @@ $date = Get-Date
$date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' } $date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' }
Write-Host "$($date2) Starting $($myName) $($myVersion) script" 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 $ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null
$modNI = $modNS = $namalskMission = $pathNamalskMission = $null $modNI = $modNS = $namalskMission = $pathNamalskMission = $null
@@ -117,6 +121,14 @@ $config = $ini.Config
[string]$updatePeriod = $config.updatePeriod [string]$updatePeriod = $config.updatePeriod
[bool]$rotateLogs = [int]$config.rotateLogs [bool]$rotateLogs = [int]$config.rotateLogs
function Init {
}
function Update {
}
$clientMods = New-Object 'Collections.Generic.List[Tuple[string,string]]' $clientMods = New-Object 'Collections.Generic.List[Tuple[string,string]]'
foreach ($mod in $ini.ClientMods.GetEnumerator()) { foreach ($mod in $ini.ClientMods.GetEnumerator()) {
if ($mod.Key -notlike "Comment*" ) { if ($mod.Key -notlike "Comment*" ) {