-
This commit is contained in:
@@ -209,6 +209,7 @@ mpv.net bugs and requests: <https://github.com/stax76/mpv.net/issues>
|
|||||||
- new options osd-font-size, sub-font, sub-font-size, sub-color, sub-border-color, sub-back-color
|
- new options osd-font-size, sub-font, sub-font-size, sub-color, sub-border-color, sub-back-color
|
||||||
- the config editor no longer shows the command line switches
|
- the config editor no longer shows the command line switches
|
||||||
- the github start page was greatly improved
|
- the github start page was greatly improved
|
||||||
|
- the setup.ps1 PowerShell script was greatly improved in regard of error handling and readability
|
||||||
|
|
||||||
### 3.7
|
### 3.7
|
||||||
|
|
||||||
|
|||||||
18
setup.ps1
18
setup.ps1
@@ -1,3 +1,6 @@
|
|||||||
|
using namespace System.IO;
|
||||||
|
|
||||||
|
# exit the script if the exit code is greater than 0
|
||||||
function CheckExitCode {
|
function CheckExitCode {
|
||||||
if ($LastExitCode -gt 0) {
|
if ($LastExitCode -gt 0) {
|
||||||
Write-Host "`nExit code $LastExitCode was returned.`n" -ForegroundColor Red
|
Write-Host "`nExit code $LastExitCode was returned.`n" -ForegroundColor Red
|
||||||
@@ -5,16 +8,30 @@ function CheckExitCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# exit the script if the file don't exist
|
||||||
|
function CheckFileExist($path) {
|
||||||
|
if (![File]::Exists($path)) {
|
||||||
|
Write-Host "`nFile is missing:`n`n$path`n" -ForegroundColor Red
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
|
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
|
||||||
$innoSetup = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
|
$innoSetup = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
|
||||||
$sevenZip = "C:\Program Files\7-Zip\7z.exe"
|
$sevenZip = "C:\Program Files\7-Zip\7z.exe"
|
||||||
|
|
||||||
|
# exit the script if one of the executables don't exist
|
||||||
|
CheckFileExist($msbuild); CheckFileExist($innoSetup); CheckFileExist($sevenZip);
|
||||||
|
|
||||||
|
# build the projects using msbuild
|
||||||
& $msbuild mpv.net.sln /p:Configuration=Debug /p:Platform=x64; CheckExitCode
|
& $msbuild mpv.net.sln /p:Configuration=Debug /p:Platform=x64; CheckExitCode
|
||||||
& $msbuild mpv.net.sln /p:Configuration=Debug /p:Platform=x86; CheckExitCode
|
& $msbuild mpv.net.sln /p:Configuration=Debug /p:Platform=x86; CheckExitCode
|
||||||
|
|
||||||
|
# build the setups using inno setup
|
||||||
& $innoSetup /Darch="x64" setup.iss; CheckExitCode
|
& $innoSetup /Darch="x64" setup.iss; CheckExitCode
|
||||||
& $innoSetup /Darch="x86" setup.iss; CheckExitCode
|
& $innoSetup /Darch="x86" setup.iss; CheckExitCode
|
||||||
|
|
||||||
|
# create the x64 portable archives
|
||||||
$scriptDir = Split-Path -Path $PSCommandPath -Parent
|
$scriptDir = Split-Path -Path $PSCommandPath -Parent
|
||||||
$desktopDir = [Environment]::GetFolderPath("Desktop")
|
$desktopDir = [Environment]::GetFolderPath("Desktop")
|
||||||
$exePath = $scriptDir + "\mpv.net\bin\x64\mpvnet.exe"
|
$exePath = $scriptDir + "\mpv.net\bin\x64\mpvnet.exe"
|
||||||
@@ -24,6 +41,7 @@ Copy-Item $scriptDir\mpv.net\bin\x64 $targetDir -Recurse -Exclude System.Managem
|
|||||||
& $sevenZip a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"; CheckExitCode
|
& $sevenZip a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"; CheckExitCode
|
||||||
& $sevenZip a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"; CheckExitCode
|
& $sevenZip a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"; CheckExitCode
|
||||||
|
|
||||||
|
# create the x86 portable archives
|
||||||
$exePath = $scriptDir + "\mpv.net\bin\x86\mpvnet.exe"
|
$exePath = $scriptDir + "\mpv.net\bin\x86\mpvnet.exe"
|
||||||
$version = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath).FileVersion
|
$version = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath).FileVersion
|
||||||
$targetDir = $desktopDir + "\mpv.net-portable-x86-" + $version
|
$targetDir = $desktopDir + "\mpv.net-portable-x86-" + $version
|
||||||
|
|||||||
Reference in New Issue
Block a user