Half-Life 2: Deathmatch

From LANCommander
Revision as of 00:35, 1 August 2023 by DoctorDalek (talk | contribs) (Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Valve}} |Publishers = {{Game.InfoBox.Publisher|Valve}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|November 30, 2004}} |Genres = {{Game.InfoBox.Genre|Shooter}} | PCGamingWiki = Half-Life_2:_Deathmatch }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play|Path = Half-Life 2 Deathmatch.exe|Arguments = |WorkingDirectory = |Primary = True}} }} {{Game.Scripts.NameCh...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Valve
Publishers
Valve
Release Date
Windows: November 30, 2004
Genres
Shooter
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play Half-Life 2 Deathmatch.exe True

Key Change Script

$NewName = $args[0]
$InstallDir = $PSScriptRoot

function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}

Write-ReplaceContentInFile -Regex 'PlayerName=(.+)' -Replacement "PlayerName=$NewName" -FilePath "$InstallDir\rev.ini"
Write-ReplaceContentInFile -Regex 'ClanTag=(.+)' -Replacement "ClanTag=" -FilePath "$InstallDir\rev.ini"