162 |
|
|
163 |
# Main |
# Main |
164 |
|
|
165 |
|
$clmid = 'HKLM:\SOFTWARE\Microsoft\Cryptography' |
166 |
|
$clmid = (Get-ItemProperty -Path $clmid -Name MachineGuid).MachineGuid |
167 |
|
$clmid = $clmid -replace '[-]','' |
168 |
|
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider |
169 |
|
$utf8 = [system.Text.Encoding]::UTF8 |
170 |
|
$hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($clmid))) |
171 |
|
$hash = $hash.ToLower() -replace '[-]','' |
172 |
|
$rkey = 'HKCU:\SOFTWARE\GNU\XviD' |
173 |
|
$pf = (Get-ItemProperty -Path $rkey -Name PerfCount).PerfCount |
174 |
|
$rkey = (Set-ItemProperty -Path $rkey -Name PerfCount -Value 0 -Type DWord) |
175 |
$scriptpath = $MyInvocation.MyCommand.Path |
$scriptpath = $MyInvocation.MyCommand.Path |
176 |
$script:xvid_dir = Split-Path $scriptpath |
$script:xvid_dir = Split-Path $scriptpath |
177 |
$tmp = $env:temp |
$tmp = $env:temp |
182 |
} |
} |
183 |
|
|
184 |
$url = $FileContent["Update"]["url"] |
$url = $FileContent["Update"]["url"] |
185 |
|
$url = $url + "&p=" + $pf + "&h=" + $hash |
186 |
$object = Get-WebClient |
$object = Get-WebClient |
187 |
$localPath = “$tmp\update.xml” |
$localPath = “$tmp\update.xml” |
188 |
$object.DownloadFile($url, $localPath) |
$object.DownloadFile($url, $localPath) |