Browse Source

Fixed HEIF function

pull/411/head
Dmitry Nefedov 2 years ago
parent
commit
ce611114c7
  1. 61
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  2. 3
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  3. 3
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  4. 61
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  5. 61
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  6. 61
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

61
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -10740,12 +10740,8 @@ function HEIF
$Manually
)
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
# Check whether the extension is already installed
if (-not ((Get-AppxPackage -Name Microsoft.HEVCVideoExtension) -and (Get-AppxPackage -Name Microsoft.Windows.Photos)))
if (-not (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
return
}
@ -10763,7 +10759,20 @@ function HEIF
{
return
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
try
{
# Check whether https://store.rg-adguard.net is alive
@ -10789,6 +10798,7 @@ function HEIF
Method = "Post"
ContentType = "application/x-www-form-urlencoded"
Body = $Body
UseBasicParsing = $true
Verbose = $true
}
$Raw = Invoke-WebRequest @Parameters
@ -10808,6 +10818,7 @@ function HEIF
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
@ -10819,49 +10830,16 @@ function HEIF
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://github.com")
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
"Manually"
{
if ((-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension)) -and (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
try
{
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
}
}
}
@ -13589,7 +13567,7 @@ function UseStoreOpenWith
#region Update Policies
<#
.SYNOPSIS
Update Local Group Policy Editor (gpedit.msc) to make all manually created policy keys in the registry visible in the snap-in
Display all policy registry keys (even manually created ones) in the Local Group Policy Editor snap-in (gpedit.msc)
.EXAMPLE
UpdateLGPEPolicies
@ -13599,6 +13577,7 @@ function UseStoreOpenWith
.NOTES
Machine-wide user
Current user
#>
function UpdateLGPEPolicies
{

3
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -9977,7 +9977,7 @@ function MultipleInvokeContext
#region Update Policies
<#
.SYNOPSIS
Update Local Group Policy Editor (gpedit.msc) to make all manually created policy keys in the registry visible in the snap-in
Display all policy registry keys (even manually created ones) in the Local Group Policy Editor snap-in (gpedit.msc)
.EXAMPLE
UpdateLGPEPolicies
@ -9987,6 +9987,7 @@ function MultipleInvokeContext
.NOTES
Machine-wide user
Current user
#>
function UpdateLGPEPolicies
{

3
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -11198,7 +11198,7 @@ function MultipleInvokeContext
#region Update Policies
<#
.SYNOPSIS
Update Local Group Policy Editor (gpedit.msc) to make all manually created policy keys in the registry visible in the snap-in
Display all policy registry keys (even manually created ones) in the Local Group Policy Editor snap-in (gpedit.msc)
.EXAMPLE
UpdateLGPEPolicies
@ -11208,6 +11208,7 @@ function MultipleInvokeContext
.NOTES
Machine-wide user
Current user
#>
function UpdateLGPEPolicies
{

61
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -10778,12 +10778,8 @@ function HEIF
$Manually
)
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
# Check whether the extension is already installed
if (-not ((Get-AppxPackage -Name Microsoft.HEVCVideoExtension) -and (Get-AppxPackage -Name Microsoft.Windows.Photos)))
if (-not (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
return
}
@ -10801,7 +10797,20 @@ function HEIF
{
return
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
try
{
# Check whether https://store.rg-adguard.net is alive
@ -10827,6 +10836,7 @@ function HEIF
Method = "Post"
ContentType = "application/x-www-form-urlencoded"
Body = $Body
UseBasicParsing = $true
Verbose = $true
}
$Raw = Invoke-WebRequest @Parameters
@ -10846,6 +10856,7 @@ function HEIF
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
@ -10857,49 +10868,16 @@ function HEIF
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://github.com")
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
"Manually"
{
if ((-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension)) -and (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
try
{
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
}
}
}
@ -13629,7 +13607,7 @@ function UseStoreOpenWith
#region Update Policies
<#
.SYNOPSIS
Update Local Group Policy Editor (gpedit.msc) to make all manually created policy keys in the registry visible in the snap-in
Display all policy registry keys (even manually created ones) in the Local Group Policy Editor snap-in (gpedit.msc)
.EXAMPLE
UpdateLGPEPolicies
@ -13639,6 +13617,7 @@ function UseStoreOpenWith
.NOTES
Machine-wide user
Current user
#>
function UpdateLGPEPolicies
{

61
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -10159,12 +10159,8 @@ function HEIF
$Manually
)
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
# Check whether the extension is already installed
if (-not ((Get-AppxPackage -Name Microsoft.HEVCVideoExtension) -and (Get-AppxPackage -Name Microsoft.Windows.Photos)))
if (-not (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
return
}
@ -10182,7 +10178,20 @@ function HEIF
{
return
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
try
{
# Check whether https://store.rg-adguard.net is alive
@ -10208,6 +10217,7 @@ function HEIF
Method = "Post"
ContentType = "application/x-www-form-urlencoded"
Body = $Body
UseBasicParsing = $true
Verbose = $true
}
$Raw = Invoke-WebRequest @Parameters
@ -10227,6 +10237,7 @@ function HEIF
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
@ -10238,49 +10249,16 @@ function HEIF
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://github.com")
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
"Manually"
{
if ((-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension)) -and (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
try
{
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
}
}
}
@ -12994,7 +12972,7 @@ function Windows10ContextMenu
#region Update Policies
<#
.SYNOPSIS
Update Local Group Policy Editor (gpedit.msc) to make all manually created policy keys in the registry visible in the snap-in
Display all policy registry keys (even manually created ones) in the Local Group Policy Editor snap-in (gpedit.msc)
.EXAMPLE
UpdateLGPEPolicies
@ -13004,6 +12982,7 @@ function Windows10ContextMenu
.NOTES
Machine-wide user
Current user
#>
function UpdateLGPEPolicies
{

61
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -10197,12 +10197,8 @@ function HEIF
$Manually
)
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
# Check whether the extension is already installed
if (-not ((Get-AppxPackage -Name Microsoft.HEVCVideoExtension) -and (Get-AppxPackage -Name Microsoft.Windows.Photos)))
if (-not (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
return
}
@ -10220,7 +10216,20 @@ function HEIF
{
return
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
try
{
# Check whether https://store.rg-adguard.net is alive
@ -10246,6 +10255,7 @@ function HEIF
Method = "Post"
ContentType = "application/x-www-form-urlencoded"
Body = $Body
UseBasicParsing = $true
Verbose = $true
}
$Raw = Invoke-WebRequest @Parameters
@ -10265,6 +10275,7 @@ function HEIF
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
@ -10276,49 +10287,16 @@ function HEIF
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://github.com")
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net/api/GetFiles") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
"Manually"
{
if ((-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension)) -and (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
try
{
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
}
}
}
@ -13031,7 +13009,7 @@ function Windows10ContextMenu
#region Update Policies
<#
.SYNOPSIS
Update Local Group Policy Editor (gpedit.msc) to make all manually created policy keys in the registry visible in the snap-in
Display all policy registry keys (even manually created ones) in the Local Group Policy Editor snap-in (gpedit.msc)
.EXAMPLE
UpdateLGPEPolicies
@ -13041,6 +13019,7 @@ function Windows10ContextMenu
.NOTES
Machine-wide user
Current user
#>
function UpdateLGPEPolicies
{

Loading…
Cancel
Save