$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 'Name=(.+)' -Replacement "Name=$NewName" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'Name=(.+)' -Replacement "Name=$NewName" -FilePath "$InstallDir\ShareThePain\System\User.ini"
$NewName = $args[0]
$InstallDir = $PSScriptRoot
Add-Type -AssemblyName System.Windows.Forms
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
$content = (Get-Content $FilePath) -replace $Regex, $Replacement
[IO.File]::WriteAllLines($FilePath, $content)
}
$X = $Display.Width
$Y = $Display.Height
Write-ReplaceContentInFile -Regex 'StartupFullscreen=(.+)' -Replacement "StartupFullscreen=True" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'WindowedViewportX=(.+)' -Replacement "WindowedViewportX=$X" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'WindowedViewportY=(.+)' -Replacement "WindowedViewportY=$Y" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'FullscreenViewportX=(.+)' -Replacement "FullscreenViewportX=$X" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'FullscreenViewportY=(.+)' -Replacement "FullscreenViewportY=$Y" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'MenuViewportX=(.+)' -Replacement "MenuViewportX=$X" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'MenuViewportY=(.+)' -Replacement "MenuViewportY=$Y" -FilePath "$InstallDir\ShareThePain\System\Default.ini"