update script added to csproj

This commit is contained in:
Frank Skare
2019-11-13 15:01:08 +01:00
parent 7b39bfcbc4
commit e4818fae18
2 changed files with 26 additions and 0 deletions

23
mpv.net/Update.ps1 Normal file
View File

@@ -0,0 +1,23 @@
$ErrorActionPreference = 'Stop'
$targetDir = (Split-Path $args[1]) + "\new version"
$targetFile = $targetDir + '.7z'
Write-Host 'Download new version' -ForegroundColor Green
curl.exe $args[0] --location --output $targetFile
if (-not $?) { throw "curl error: $LastExitCode" }
Write-Host 'Unpack new version' -ForegroundColor Green
& ($args[1] + '\7z\7za.exe') x -y $targetFile -o"$targetDir"
if (-not $?) { throw "7zip error: $LastExitCode" }
Write-Host 'Delete downloaded file' -ForegroundColor Green
Remove-Item $targetFile -Force -Recurse
Write-Host 'Delete current version' -ForegroundColor Green
Remove-Item $args[1] -Force -Recurse
Write-Host 'Rename directory' -ForegroundColor Green
Rename-Item $targetDir (Split-Path $args[1] -Leaf)
Write-Host 'Update is complete' -ForegroundColor Green

View File

@@ -118,6 +118,9 @@
<Compile Include="Misc\App.cs" />
<Compile Include="Misc\Extension.cs" />
<Content Include="Resources\theme.txt" />
<None Include="Update.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="WPF\SearchTextBoxUserControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>