$config = @"
CREATE TABLE options (
section string,
name string,
value string
);
INSERT INTO options ROWS (
'Fonts', 'ko_KR', 'UNBOM',
'Fonts', 'zh_CN', 'SIMSUN',
'Fonts', 'ja_JP', 'MSGOTHIC',
'Fonts', 'ru_RU', 'PERMIAN',
'Fonts', 'uk_UA', 'PERMIAN',
'Window', 'Full Screen', '1',
'Graphics', 'version', '4.6.0 NVIDIA 472.12',
'Graphics', 'renderer', 'NVIDIA GeForce RTX 3080 Ti/PCIe/SSE2',
'Graphics', 'vendor', 'NVIDIA Corporation',
'MOVIES', 'LOGO', '1',
'MOVIES', 'INTRO15F', '1',
'Multiplayer', 'Last Protocol Used', '2',
'Multiplayer', 'Player Name', 'DoctorDalek12345678901234567890123456789',
'Multiplayer', 'Session Password', '',
'Multiplayer', 'Session Name', 'DoctorDalek1234567890123456789012345678901234567890'
);
"@
New-Item -ItemType Directory -Force -Path "$($env:USERPROFILE)\Documents\Baldur's Gate II - Enhanced Edition"
Set-Content "$($env:USERPROFILE)\Documents\Baldur's Gate II - Enhanced Edition\Baldur.ini" $config
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern "^\s+'Multiplayer',\s+'Player Name',\s+'(.+)'," -Substitution "`t'Multiplayer',`t'Player Name',`t'$NewPlayerAlias'," -FilePath "$($env:USERPROFILE)\Documents\Baldur's Gate II - Enhanced Edition\Baldur.ini"
Write-ReplaceContentInFile -Pattern "^\s+'Multiplayer',\s+'Session Name',\s+'(.+)'" -Substitution "`t'Multiplayer',`t'Session Name',`t'Vintage'," -FilePath "$($env:USERPROFILE)\Documents\Baldur's Gate II - Enhanced Edition\Baldur.ini"