Skip to content

Commit

Permalink
Few minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
smashedr committed Sep 22, 2020
1 parent d42dd5f commit 0904d70
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 57 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# RaiderIO Database Update
# RaiderIO AddOn Update

A simple script to update the RaiderIO database with the latest data.
A very simple and lightweight script to update the RaiderIO AddOn and database as desired.

This only catches the daily refresh at GitHub from [RaiderIO/raiderio-addon](https://github.com/RaiderIO/raiderio-addon).

No login or setup required. Will remove and update the addon if existing or add if it not there.

### Download

Latest Release: [Click Here to Download](https://github.com/smashedr/raiderio-db-update/releases/latest/download/WoW-Backup.exe).
Latest Release: [Click Here to Download](https://github.com/smashedr/raiderio-addon-update/releases/latest/download/RaiderIO-AddOn-Update.exe).

Or head over to the [releases page](https://github.com/smashedr/raiderio-db-update/releases).
Or head over to the [releases page](https://github.com/smashedr/raiderio-addon-update/releases).
6 changes: 3 additions & 3 deletions build/build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$source_file_name = "raiderio-db.update.ps1"
$output_file_name = "RaiderIO-DB-Update.exe"
$application_name = "RaiderIO DB Update"
$source_file_name = "raiderio-addon-update.ps1"
$output_file_name = "RaiderIO-AddOn-Update.exe"
$application_name = "RaiderIO AddOn Update"
$author_name = "Shane"

$ErrorActionPreference = "Stop"
Expand Down
84 changes: 84 additions & 0 deletions raiderio-addon-update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
$rio_gh_url = "https://github.com/RaiderIO/raiderio-addon/archive/master.zip"

$ErrorActionPreference = "Stop"
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

function ExitScript() {
Read-Host -Prompt "Press <enter> to exit or close this window"
exit
}

Write-Output "`nStarting the RaiderIO AddOn Update using source: $rio_gh_url`n"

$wow_dir_path = Join-Path -Path ${Env:ProgramFiles(x86)} -ChildPath "World of Warcraft"

if (Test-Path $wow_dir_path)
{
$wow_dir = Get-Item $wow_dir_path
Write-Output "Found WoW installation directory: $wow_dir"
} else {
$wow_folder = New-Object System.Windows.Forms.FolderBrowserDialog
$wow_folder.Description = "Select your World of Warcraft installation directory..."
$wow_folder.rootfolder = "MyComputer"

if($wow_folder.ShowDialog() -eq "OK")
{
$wow_folder_path += $wow_folder.SelectedPath
} else {
Write-Output "No WoW directory selected, please try again."
ExitScript
}

$wow_dir = Get-Item $wow_folder_path
Write-Output "User selected WoW installation directory: $wow_dir"
}

$addons_dir = Join-Path -Path $wow_dir -ChildPath "_retail_\Interface\AddOns"
if (!(Test-Path $addons_dir)) {
Write-Output "Error, WoW AddOns directory not found: $addons_dir"
ExitScript
}
Write-Output "Found WoW AddOns directory: $addons_dir"

$temp_dir = New-Item -Force -Path $env:TEMP -Name "raiderio-db-update" -ItemType "directory"
$db_zip_file_path = Join-Path -Path $temp_dir.FullName -ChildPath "raiderio-addon-master.zip"

if ($temp_dir.GetFiles() -or $temp_dir.GetDirectories()) {
Write-Output "Removing and re-creating existing temp directory: $temp_dir"
$temp_dir.Delete($true)
$temp_dir = New-Item -Force -Path $env:TEMP -Name "raiderio-db-update" -ItemType "directory"
}

Write-Output "Downloading new database to: $db_zip_file_path"
$response = Invoke-WebRequest -uri $rio_gh_url -outfile $db_zip_file_path

Write-Output "Extracting database to temp directory: $temp_dir"
Expand-Archive -literalpath $db_zip_file_path -destinationpath $temp_dir.FullName

Write-Output "Building new addon locally..."
Set-Location -Path $temp_dir
Remove-Item -Force $db_zip_file_path
Rename-Item -Path "raiderio-addon-master" -NewName "RaiderIO"
Move-Item -Path "RaiderIO\db\RaiderIO_DB_*" -Destination ".\"

Remove-Item "RaiderIO\*" -Include *.* -Exclude *.lua,*.toc,*.xml
if (Test-Path "RaiderIO\tools") { Remove-Item -Recurse -Force "RaiderIO\tools" }
if (Test-Path "RaiderIO\LICENSE") { Remove-Item "RaiderIO\LICENSE" }

$rio_ad_dir = Join-Path -Path $addons_dir -ChildPath "RaiderIO"
if (Test-Path $rio_ad_dir) {
Write-Output "Removing Live AddOn from WoW AddOns directory: $addons_dir"
Get-ChildItem "$addons_dir\RaiderIO*"
Remove-Item -Recurse -Force "$addons_dir\RaiderIO*"
}

Write-Output "Moving new addon and database to live WoW AddOns..."
Move-Item -Path "$temp_dir\*" -Destination $addons_dir

Write-Output "Cleaning up temp directory: $temp_dir"
$temp_dir.Delete($true)

Write-Output "`nSuccess! Done updating RaiderIO AddOn and Database...`n"
Read-Host -Prompt "Press <enter> to exit or close this window"
50 changes: 0 additions & 50 deletions raiderio-db-update.ps1

This file was deleted.

0 comments on commit 0904d70

Please sign in to comment.