# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$($env:USERPROFILE)\Documents\My Games\dhewm3" -Recurse
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^seta r_customHeight "(.+)"' -Substitution "seta r_customHeight ""$($Display.Bounds.Height)""" -FilePath "$($env:USERPROFILE)\Documents\My Games\dhewm3\base\dhewm.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customWidth "(.+)"' -Substitution "seta r_customWidth ""$($Display.Bounds.Width)""" -FilePath "$($env:USERPROFILE)\Documents\My Games\dhewm3\base\dhewm.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customHeight "(.+)"' -Substitution "seta r_customHeight ""$($Display.Bounds.Height)""" -FilePath "$($env:USERPROFILE)\Documents\My Games\dhewm3\d3xp\dhewm.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customWidth "(.+)"' -Substitution "seta r_customWidth ""$($Display.Bounds.Width)""" -FilePath "$($env:USERPROFILE)\Documents\My Games\dhewm3\d3xp\dhewm.cfg"
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^seta ui_name "(.+)"' -Substitution "seta ui_name ""$NewPlayerAlias""" -FilePath "$($env:USERPROFILE)\Documents\My Games\dhewm3\base\dhewm.cfg"
Write-ReplaceContentInFile -Pattern '^seta ui_name "(.+)"' -Substitution "seta ui_name ""$NewPlayerAlias""" -FilePath "$($env:USERPROFILE)\Documents\My Games\dhewm3\d3xp\dhewm.cfg"