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

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в 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 в той же папке, где и скрипт.
# Настройки не переписываются.
 
$infourl = "https://api.github.com/repos/VictorVG/ph/releases/latest"
$siteurl = "https://github.com/VictorVG/ph"
$archivelink = "https://github.com/VictorVG/ph/raw/master/processhacker-3.0-bin.zip"
$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 {""}
 
Write-Host "Update ProcessHacker"
Write-Host "Check..."
$info = Invoke-WebRequest $infourl | ConvertFrom-Json
$release = if ($info.tag_name -match '(\d+\.\d+\.\d+\.\d+)') {$matches[1]} {""}
$archivelink = ($info.assets | where {$_.content_type -eq "application/x-zip-compressed"}).browser_download_url
$archive = Join-Path $appdir ([System.IO.Path]::GetFileName($archivelink))
 
Add-Type -AssemblyName System.IO.Compression
Add-Type -AssemblyName System.IO.Compression.FileSystem
 
[System.Net.ServicePointManager]::SecurityProtocol = 'SSL3,TLS,TLS11,TLS12'
Write-Host "Release: $release"
Write-Host "Link: $archivelink"
Write-Host "Current version x32: $version32"
Write-Host "Current version x64: $version64"
if ($release -and $archivelink -and ($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"
}

Всего записей: 3218 | Зарегистр. 09-02-2003 | Отправлено: 14:49 24-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