$Documents = [Environment]::GetFolderPath("CommonDocuments")
Copy-Item -Path "$InstallDirectory\Monolith Productions" -Destination "$Documents" -Recurse
# Bounds are accessible by $Display.Width and $Display.Height
$Display = Get-PrimaryDisplay
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^"ScreenWidth" "(.+)"' -Substitution """ScreenWidth"" ""$($Display.Bounds.Width)""" -FilePath "$Documents\Monolith Productions\FEARCombat\Settings.cfg"
Write-ReplaceContentInFile -Pattern '^"ScreenHeight" "(.+)"' -Substitution """ScreenHeight"" ""$($Display.Bounds.Height)""" -FilePath "$Documents\Monolith Productions\FEARCombat\Settings.cfg"
$Documents = [Environment]::GetFolderPath("CommonDocuments")
Remove-Item -Path "$Documents\Monolith Productions" -Recurse -Force
$Documents = [Environment]::GetFolderPath("CommonDocuments")
$bytes = ConvertTo-StringBytes -Input $NewPlayerAlias -Utf16 1 -MaxLength 15 -MinLength 15
Edit-PatchBinary -FilePath "$Documents\Monolith Productions\FEARCombat\Profiles\Profile000.gdb" -Offset 0x660 -Data $bytes
$Documents = [Environment]::GetFolderPath("CommonDocuments")
Set-Content -Path "$Documents\Monolith Productions\FEARCombat\key.ini" -value "[FEAR]`nCDKey=$AllocatedKey" -Force