Optimized

pull/166/head
KnifMelti 2022-09-20 01:02:51 +02:00
parent e05cf326a7
commit 6ce3171b67
1 changed files with 4 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#Function to check Black/White List Path #Function to check Black/White List External Path
function Test-ListPath ($ListPath, $UseWhiteList) { function Test-ListPath ($ListPath, $UseWhiteList) {
# UNC, Web or Local Path # UNC, Web or Local Path
@ -24,11 +24,9 @@ function Test-ListPath ($ListPath, $UseWhiteList) {
Write-Host("$ExternalList is newer than $LocalList") Write-Host("$ExternalList is newer than $LocalList")
return $true return $true
} }
return $false
} }
else { else {
Write-Host "Given path $ListPath type is $PathType and $ExternalList is not available..." Write-Host "Given path $ListPath type is $PathType and $ExternalList is not available..."
return $false
} }
} }
elseif ($ListPath -like "http*"){ elseif ($ListPath -like "http*"){
@ -43,11 +41,9 @@ function Test-ListPath ($ListPath, $UseWhiteList) {
Write-Host("$ExternalList is newer than $LocalList") Write-Host("$ExternalList is newer than $LocalList")
return $true return $true
} }
return $false
} }
catch { catch {
Write-Host "Given path $ListPath type is $PathType and $ExternalList is not available..." Write-Host "Given path $ListPath type is $PathType and $ExternalList is not available..."
return $false
} }
} }
else { else {
@ -60,18 +56,19 @@ function Test-ListPath ($ListPath, $UseWhiteList) {
Write-Host("$ExternalList is newer than $LocalList") Write-Host("$ExternalList is newer than $LocalList")
return $true return $true
} }
return $false
} }
else { else {
Write-Host "Given path $ListPath type is $PathType and $ExternalList is not available..." Write-Host "Given path $ListPath type is $PathType and $ExternalList is not available..."
return $false
} }
} }
return $false
} }
$WingetUpdatePath = "$env:ProgramData\Winget-AutoUpdate" $WingetUpdatePath = "$env:ProgramData\Winget-AutoUpdate"
$ListPath = "https://www.knifmelti.se" $ListPath = "https://www.knifmelti.se"
#$ListPath = "D:\Temp" #$ListPath = "D:\Temp"
#$ListPath = "\\TempSERVER"
#$UseWhiteList = $true #$UseWhiteList = $true
#White List or Black List in share/online if differs #White List or Black List in share/online if differs
if ($WingetUpdatePath -ne $ListPath){ if ($WingetUpdatePath -ne $ListPath){