$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)
}
$Path = "$($env:LOCALAPPDATA)\AlephOne\Marathon Preferences"
Write-ReplaceContentInFile -Regex "player name=""[^""]+""" -Replacement "player name=`"$NewName`"" -FilePath $Path
$InstallDir = $PSScriptRoot
New-Item -ItemType Directory -Force -Path "$($env:LOCALAPPDATA)\AlephOne"
Copy-Item -Path "$InstallDir\Preferences" -Destination "$($env:LOCALAPPDATA)\AlephOne\Marathon Preferences"