-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathupdate-libraries.ps1
More file actions
22 lines (19 loc) · 889 Bytes
/
update-libraries.ps1
File metadata and controls
22 lines (19 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mkdir -Force $PSScriptRoot\lib | Out-Null
"Looking for Hearthstone Deck Tracker install..."
$HDTPath = "$Env:LOCALAPPDATA\HearthstoneDeckTracker"
if(Test-Path $HDTPath)
{
$HDTExe = Get-ChildItem "$Env:LOCALAPPDATA\HearthstoneDeckTracker" | Where-Object { $_.PSIsContainer -and $_.Name.StartsWith("app-")} | Sort-Object CreationTime -desc | Select-Object -f 1 | Get-ChildItem | Where-Object { $_.Name.Equals("HearthstoneDeckTracker.exe")}
if($HDTExe.Exists)
{
"Copying $($HDTExe.Name) v$($HDTExe.VersionInfo.FileVersion)... "
Copy-Item $HDTExe.FullName "$PSScriptRoot\lib\$($HDTExe.Name)" -Force
}
}
function FetchLib($name) {
"Fetching $name..."
$url = "https://libs.hearthsim.net/hdt/$name.dll"
try { (New-Object Net.WebClient).DownloadFile($url, "$PSScriptRoot\lib\$name.dll") }
catch { $error[0].Exception.ToString() }
}
FetchLib "HearthDb"