Call of Duty

From LANCommander
Revision as of 00:51, 27 July 2023 by DoctorDalek (talk | contribs) (Created page with "Category:Games {{InfoBox.Game |Cover = cover.jpg |Developers = {{InfoBox.Game.Developer|Infinity Ward}} |Publishers = {{InfoBox.Game.Publisher|Activision}} |Release Date = {{InfoBox.Game.ReleaseDate|Windows|October 29, 2003}} |Genres = {{InfoBox.Game.Genre|Shooter}} | PCGamingWiki = Call_of_Duty }} == Name Change Script == <syntaxhighlight lang="powershell" line> $NewName = $args[0] $InstallDir = $PSScriptRoot function Write-ReplaceContentInFile([string]$Regex, [st...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:InfoBox.Game

Name 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 '^seta name (.+)' -Replacement "seta name ""$NewName""" -FilePath "$InstallDir\Main\config_mp.cfg"
Write-ReplaceContentInFile -Regex '^seta name (.+)' -Replacement "seta name ""$NewName""" -FilePath "$InstallDir\uo\uoconfig_mp.cfg"

Key Change Script

# Requires Admin

$Key = $args[0]

$Key = $Key.Replace("-", "")

$codkey, $coduokey = $Key -Split ',',2

# Non-destructively creates path in registry
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Activision"
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty"
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive"

# Creates or updates a key in the registry
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty" -Name "codkey" -Value $codkey -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive" -Name "key" -Value $coduokey -Force