Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Process Hacker (часть 2)

Модерирует : gyra, Maz

Maz (31-10-2019 22:20): Process Hacker (часть 3) только официальные сборки  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

Smitis



Silver Member
Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору

Код:
# Обновление ProcessHacker с https://github.com/VictorVG/ph
# Обновляются обе версии x86 и x64 которые находятся в соответствующих подпапках x86 и x64 в той же папке, где и скрипт.
# Настройки не переписываются.
 
$siteurl = "https://github.com/VictorVG/ph"
$archivelink = "https://github.com/VictorVG/ph/raw/master/processhacker-3.0-bin.zip"
$presentmask = 'href="(/[^"]+/processhacker-[\d.]+-bin.zip)"'
$versionmask = ">v([\d.]+) Git-[\da-f]+<"
 
Add-Type -AssemblyName System.IO.Compression
Add-Type -AssemblyName System.IO.Compression.FileSystem
 
Write-Host "Update ProcessHacker"
Write-Host "Check..."
$present = $false
$version = $false
$appdir = $MyInvocation.MyCommand.Path | Split-Path -Parent
$exefile32 = Join-Path $appdir "x86\ProcessHacker.exe"
$exefile64 = Join-Path $appdir "x64\ProcessHacker.exe"
$version32 = if(Test-Path -Lit $exefile32) {(Get-ItemProperty -Lit $exefile32).VersionInfo.FileVersion} else {""}
$version64 = if(Test-Path -Lit $exefile64) {(Get-ItemProperty -Lit $exefile64).VersionInfo.FileVersion} else {""}
$archive = Join-Path $appdir ([System.IO.Path]::GetFileName($archivelink))
[System.Net.ServicePointManager]::SecurityProtocol = 'SSL3,TLS,TLS11,TLS12'
$web = Invoke-WebRequest -URI $siteurl
foreach ($c in $web.content) {
    if (-not $present -and $c -match $presentmask) {
        $present = $true
    }
    if ($present -and -not $release -and $c -match $versionmask) {
        $release = $Matches[1]
    }
    if ($present -and $release ) {
        Write-Host "Release: $release"
        Write-Host "Link: $archivelink"
        Write-Host "Current version x32: $version32"
        Write-Host "Current version x64: $version64"
        if ($version32 -ne $release -or $version64 -ne $release) {
            Write-Host "Download..."
            #Start-BitsTransfer $archivelink -TransferType Download
            Invoke-WebRequest $archivelink -Out $archive
            if (Test-Path -Lit $archive) {
                Write-Host "Unpack..."
                #[System.IO.Directory]::Delete("",$true)
                Remove-Item "$appdir\x86\plugins" -Recurse -Force -EA SilentlyContinue
                Remove-Item "$appdir\x64\plugins" -Recurse -Force -EA SilentlyContinue
                Remove-Item "$appdir\x64\x86" -Recurse -Force -EA SilentlyContinue
                if (-not (Test-Path -Lit "$appdir\x86\plugins\plugindata")) {
                    #New-Item "$appdir\x86\plugins\plugindata" -Type Directory -Force #| Out-Null
                    [System.IO.Directory]::CreateDirectory("$appdir\x86\plugins\plugindata") | Out-Null
                }
                if (-not (Test-Path -Lit "$appdir\x64\plugins\plugindata")) {
                    #New-Item "$appdir\x64\plugins\plugindata" -Type Directory -Force #| Out-Null
                    [System.IO.Directory]::CreateDirectory("$appdir\x64\plugins\plugindata") | Out-Null
                }
                if (-not (Test-Path -Lit "$appdir\x64\x86\plugins")) {
                    #New-Item "$appdir\x64\x86\plugins" -Type Directory -Force #| Out-Null
                    [System.IO.Directory]::CreateDirectory("$appdir\x64\x86\plugins") | Out-Null
                }
                $zip = [System.IO.Compression.ZipFile]::OpenRead($archive)
                $zip.Entries | foreach {
                    $fullname = $_.FullName
                    $fullpath = Join-Path $appdir $fullname
                    if (".xml",".txt" -notcontains [System.IO.Path]::GetExtension($_.FullName) -and $_.FullName -notmatch "/$") {
                        #Write-Host $_.FullName
                        $saveStream = [System.IO.File]::Create($_.FullName)
                        $zipStream = $_.Open()
                        $zipStream.CopyTo($saveStream)
                        $zipStream.Close()
                        $zipStream.Dispose()
                        $saveStream.Close()
                        $saveStream.Dispose()
                    }
                }
                $zip.Dispose()
                Remove-Item $archive -Force
            }
            Write-Host "Done"
        }
        break
    }
}

Всего записей: 3214 | Зарегистр. 09-02-2003 | Отправлено: 23:43 29-10-2018 | Исправлено: Smitis, 20:45 21-11-2018
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Process Hacker (часть 2)
Maz (31-10-2019 22:20): Process Hacker (часть 3) только официальные сборки


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru