Upload files to "/"
This commit is contained in:
67
start_next_ldplayer.ps1
Normal file
67
start_next_ldplayer.ps1
Normal file
@@ -0,0 +1,67 @@
|
||||
#run ldplayer instance
|
||||
$global:LDPlayerPath ="C:\Ldplayer\LDplayer9"
|
||||
|
||||
function logger($logMessage) {
|
||||
[int]$number = (get-content -path "$global:LDPlayerPath\index_count.txt")
|
||||
if($number -gt 21){
|
||||
$number=0
|
||||
}
|
||||
|
||||
|
||||
$instanceList = Get-Content -Path "$global:LDPlayerPath\instanceList.txt"
|
||||
$instanceNumber = $instanceList[$number-1]
|
||||
$instanceData = (cat C:\Ldplayer\LDplayer9\vms\config\leidian${instanceNumber}.config)
|
||||
$convertedData = $instanceData | ConvertFrom-Json
|
||||
$name = $convertedData."statusSettings.playerName"
|
||||
$count = $number+1
|
||||
|
||||
$scriptName = Split-Path -Leaf $PSCommandPath
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss.fff"
|
||||
$timestampedLogMessage = $timestamp + "-$name, ($count/22)-$scriptName-PID: ${PID}-:" + $logMessage
|
||||
$logFilePath = "$global:LDPlayerPath\LDAutoLog.txt"
|
||||
$fs = New-Object System.IO.FileStream($logFilePath, [System.IO.FileMode]::Append, [System.IO.FileAccess]::Write, [System.IO.FileShare]::Read)
|
||||
$sw = New-Object System.IO.StreamWriter($fs)
|
||||
try {
|
||||
$sw.WriteLine($timestampedLogMessage)
|
||||
} finally {
|
||||
$sw.Close()
|
||||
$fs.Close()
|
||||
}
|
||||
}
|
||||
|
||||
[int]$number = (get-content -path "c:\ldplayer\ldplayer9\index_count.txt")
|
||||
if($number -gt 21){
|
||||
|
||||
$number=0
|
||||
|
||||
$number | Out-File -FilePath "C:\Ldplayer\Ldplayer9\index_count.txt"
|
||||
return "Done"
|
||||
}
|
||||
$number
|
||||
$instanceList = Get-Content -Path "$global:LDPlayerPath\instanceList.txt"
|
||||
$instanceList
|
||||
$instanceNumber = $instanceList[$number-1]
|
||||
$instanceNumber
|
||||
if($instanceNumber -eq 21) {$filename = "C:\Ldplayer\LDplayer9\vms\config\leidian21.config"
|
||||
}else{$filename = "C:\Ldplayer\LDplayer9\vms\config\leidian${instanceNumber}.config"
|
||||
}
|
||||
$filename
|
||||
$instanceData = (cat C:\Ldplayer\LDplayer9\vms\config\leidian${instanceNumber}.config)
|
||||
if($instanceData -match '10\.0\.211\.125'){
|
||||
logger("making sure ip is correct")
|
||||
$newData = $instanceData -replace '10\.0\.211\.125', '10\.0\.211\.121'
|
||||
Set-Content -Path $filename -Value $filename -Value $newData -Encoding UTF8
|
||||
} else {logger("IP is already correct")}
|
||||
$convertedData = $instanceData | ConvertFrom-Json
|
||||
$name = $convertedData."statusSettings.playerName"
|
||||
$count = $number+1
|
||||
logger("starting instance $instanceNumber, $name, ($count/21)")
|
||||
$launchCMD = "ldconsole.exe launch --index $instanceNumber"
|
||||
Start-Sleep -milliseconds 1000
|
||||
$launchCMD | Out-File -FilePath "C:\Ldplayer\Ldplayer9\launchNow.txt"
|
||||
|
||||
<#
|
||||
$number=$number + 1
|
||||
if($number -eq 23){ $number=0}
|
||||
$number | Out-File -FilePath "c:\ldplayer\ldplayer9\index_count.txt"
|
||||
#>
|
||||
Reference in New Issue
Block a user