added dev switcher script

This commit is contained in:
Ben Carter
2023-09-14 22:26:30 -04:00
parent 4011cde027
commit 5072faeff4
3 changed files with 37 additions and 1 deletions

View File

@@ -1,2 +1,13 @@
# wow-dev-server-toggle
Simple windows scripting that toggles to a local dev or back to production saving time.
Simple helper to make it easier to switch between dev and production realmlist. Follow the instructions then create a shortcut on your desktop to enable quick toggling between environments
(Prod and Dev).
I also included an icon you can use for the Shortcut if you want.
## Instructions
1. Create two files in your realmlist besides your main realmlist.wtf realmlist.prod.wtf and realmlist.dev.wtf. Configure the environments correctly.
2. Open switch_server.ps1 - update file with correct folder path to where your realmlist.wtf
3. Open switch_server.bat and update file path to folder where realmlist.wtf
4. Create a shortcut and add the icon and target to the bat. all done

3
WoWServerSwitch.bat Executable file
View File

@@ -0,0 +1,3 @@
@echo off
powershell.exe -ExecutionPolicy Bypass -File "[Replace with your Path]/switch_server.ps1"
pause

22
switch_server.ps1 Executable file
View File

@@ -0,0 +1,22 @@
$folderPath = "[Replace with your path to Wow\Data\enUS\]"
# Check if realmlist.wtf and realmlist.prod.wtf exist
$realmlistExists = Test-Path "$folderPath\realmlist.wtf"
$realmlistProdExists = Test-Path "$folderPath\realmlist.prod.wtf"
# Check if realmlist.dev.wtf exists
$realmlistDevExists = Test-Path "$folderPath\realmlist.dev.wtf"
if ($realmlistExists -and $realmlistProdExists) {
Rename-Item "$folderPath\realmlist.wtf" "realmlist.dev.wtf" -Force
Rename-Item "$folderPath\realmlist.prod.wtf" "realmlist.wtf" -Force
Write-Host "Switching to production server"
}
elseif ($realmlistExists -and $realmlistDevExists) {
Rename-Item "$folderPath\realmlist.wtf" "realmlist.prod.wtf" -Force
Rename-Item "$folderPath\realmlist.dev.wtf" "realmlist.wtf" -Force
Write-Host "Switching to local dev server"
}
else {
Write-Host "Files not found or conditions not met"
}