Created
January 1, 2019 20:38
-
-
Save Deshke/50997806d05a5443f7a281c23f8c22e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Modify as required. Points to the default install location | |
$GW2Path = "C:\Program Files\Guild Wars 2\" | |
#Don't change these paths unless arc does | |
$md5sum = 'https://www.deltaconnected.com/arcdps/x64/d3d9.dll.md5sum' | |
$d3d9 = 'https://www.deltaconnected.com/arcdps/x64/d3d9.dll' | |
#And this one unless ANet does | |
$gw = 'Gw2-64' | |
function Get-ArcDps | |
{ | |
write-host 'Downloading ArcDps' | |
$d3d9Temp = New-TemporaryFile | |
Invoke-WebRequest -Uri $d3d9 -OutFile $d3d9Temp.FullName | |
Copy-Item $d3d9Temp.FullName "$($GW2Path)\bin64\d3d9.dll" -Force | |
Remove-Item $d3d9Temp.FullName -Force | |
write-host 'Completed ArcDps install' | |
} | |
function Invoke-ArcDpsCheck | |
{ | |
$date = (Get-Date -format "MM-dd-yyyy") | |
if((Get-Process $gw -EA 0).Count -gt 0) | |
{ | |
Exit | |
} | |
$ignoreCase = [System.StringComparison]::InvariantCultureIgnoreCase | |
$md5Temp = New-TemporaryFile | |
Invoke-WebRequest -Uri $md5sum -OutFile $md5Temp.FullName | |
$md5Hash = Get-Content $md5Temp | |
$md5Hash = $md5Hash.Substring(0,$md5Hash.IndexOf(' ')) | |
$fileExists = Test-Path "$($GW2Path)\bin64\d3d9.dll" | |
if($fileExists) | |
{ | |
$md5D3d9m = Get-FileHash "$($GW2Path)\bin64\d3d9.dll" -Algorithm MD5 | |
if(!$md5D3d9m.Hash.Equals($md5Hash,$ignoreCase)) | |
{ | |
Write-Host 'ArcDps is out of date' | |
try | |
{ | |
Rename-Item "$($GW2Path)\bin64\d3d9.dll" -NewName "$($GW2Path)\bin64\d3d9.$date" -Force | |
} | |
catch {} | |
Get-ArcDps | |
} | |
else | |
{ | |
write-host 'ArcDps is up to date' | |
} | |
} | |
else | |
{ | |
Get-ArcDps | |
} | |
} | |
Invoke-ArcDpsCheck |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment