Skip to content

Instantly share code, notes, and snippets.

@Omochin
Created November 19, 2017 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Omochin/d873badf4eb2d86f95d220c9efe1319e to your computer and use it in GitHub Desktop.
Save Omochin/d873badf4eb2d86f95d220c9efe1319e to your computer and use it in GitHub Desktop.
Input the profile name and update all the setting files in the profile's folder.
if ($args.Length -eq 0)
{
Write-Host "Please input profile name."
pause
exit
}
if (!(Test-Path ./core_user.dat -PathType Leaf))
{
Write-Host "./core_user.dat does not exist"
pause
exit
}
if (!(Test-Path ./core_char.dat -PathType Leaf))
{
Write-Host "./core_char.dat does not exist"
pause
exit
}
$tranquility_path = "$HOME\AppData\Local\CCP\EVE\d_eve_sharedcache_tq_tranquility\"
$settings_name = "settings_" + $args[0]
$settings_path = $tranquility_path + $settings_name
if (!(Test-Path $settings_path -PathType Container))
{
Write-Host "Settings folder does not exist: $settings_path"
pause
exit
}
if (Test-Path ./$settings_name) { Remove-Item ./$settings_name -Recurse }
New-Item ./$settings_name -ItemType Directory
foreach($file in Get-ChildItem $settings_path)
{
$split_names = $file.Name.Split("_")
if (($split_names.Length -eq 3) -and ($split_names[0] -eq "core"))
{
if ($split_names[1] -eq "user")
{
Copy-Item ./core_user.dat ./$settings_name
Rename-Item ./$settings_name/core_user.dat $file.name
}
elseif ($split_names[1] -eq "char")
{
Copy-Item ./core_char.dat ./$settings_name
Rename-Item ./$settings_name/core_char.dat $file.name
}
else
{
Copy-Item $file.fullname ./$settings_name -recurse
}
}
else
{
Copy-Item $file.fullname ./$settings_name -recurse
}
}
$date_text = Get-Date -UFormat "%Y-%m-%d-%H%M%S"
Rename-Item $settings_path ($settings_name + "_" + $date_text)
Move-Item ./$settings_name $tranquility_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment