From 5072faeff40070a403b06a120c44ba35e9b13de1 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Thu, 14 Sep 2023 22:26:30 -0400 Subject: [PATCH] added dev switcher script --- README.md | 13 ++++++++++++- WoWServerSwitch.bat | 3 +++ switch_server.ps1 | 22 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 WoWServerSwitch.bat create mode 100755 switch_server.ps1 diff --git a/README.md b/README.md index 3e0242e..b54077a 100644 --- a/README.md +++ b/README.md @@ -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 + + diff --git a/WoWServerSwitch.bat b/WoWServerSwitch.bat new file mode 100755 index 0000000..34ef3b3 --- /dev/null +++ b/WoWServerSwitch.bat @@ -0,0 +1,3 @@ +@echo off +powershell.exe -ExecutionPolicy Bypass -File "[Replace with your Path]/switch_server.ps1" +pause diff --git a/switch_server.ps1 b/switch_server.ps1 new file mode 100755 index 0000000..69b5b99 --- /dev/null +++ b/switch_server.ps1 @@ -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" +}