/
TuningPack.ps1
76 lines (74 loc) · 3.15 KB
/
TuningPack.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Set-ExecutionPolicy Unrestricted -Scope Process
function WriteTime {
Param ([string]$t)
Write-Output "$(Get-Date) $t"
}
#Tuning Pack Downloader
############################################################################################################################################################################################################
while (!(test-connection 37.120.179.48 -Count 1 -Quiet)) {
$Verbindungbesteht = $true
break
}
if ($Verbindungbesteht){
$Internet = $false
} else {
$Internet = $true
}
if ($Internet){
WriteTime "Internetverbindung: Online"
} else {
WriteTime "Internetverbindung: Offline"
}
##########################################################################################################################################################################
$Gedownloaded = Test-Path .\TuningPack\
if ($Gedownloaded){
WriteTime "Das Tuning Pack wurde bereits heruntergeladen"
} else {
if ($Internet){
WriteTime "Das Tuning Pack muss heruntergeladen werden"
} else {
WriteTime "Das Tuning Pack ist nicht Installiert, jedoch besteht keine Internetverbindung. Das Programm wird beendet."
}
}
if ($Internet){
$NeusteVersion = Invoke-WebRequest http://root3.minerswin.de/TGF/TuningPack/LatestVersion.html -UseBasicParsing
WriteTime "Neuste Version: $($NeusteVersion)"
if ($Gedownloaded){
$VersionInstalliert = Get-Content .\TuningPack\Version.txt
if ($NeusteVersion.Content -gt $VersionInstalliert){
WriteTime "Die aktuelle Version wird nicht mehr Unterstüzt. Die neuste wird heruntergeladen."
WriteTime "Tuning Pack wurde beendet"
del .\TuningPack -Recurse -Force
WriteTime "Tuning Pack wurde gelöscht"
$Downloadlink = curl http://root3.minerswin.de/TGF/TuningPack/DownloadLink.html -UseBasicParsing
WriteTime "Der Download wird gestartet"
wget $Downloadlink.Content -OutFile 'TuningPack.zip' -UseBasicParsing
WriteTime "Der Download wurde abgeschlossen"
Expand-Archive .\TuningPack.zip -DestinationPath .\TuningPack\
rm TuningPack.zip
Set-Location .\TuningPack\
WriteTime "Das Tuning Pack wird gestartet"
$NeusteVersion.Content | Out-File -FilePath .\Version.txt
Start-Process powershell .\GUI.ps1
} else {
Set-Location .\TuningPack\
Start-Process powershell .\GUI.ps1
}
} else {
$Downloadlink = curl http://root3.minerswin.de/TGF/TuningPack/DownloadLink.html -UseBasicParsing
WriteTime "Der Download wird gestartet"
wget $Downloadlink.Content -OutFile 'TuningPack.zip' -UseBasicParsing
WriteTime "Der Download wurde abgeschlossen"
Expand-Archive .\TuningPack.zip -DestinationPath .\TuningPack\
rm TuningPack.zip
Set-Location .\TuningPack\
WriteTime "Das Tuning Pack wird gestartet"
$NeusteVersion.Content | Out-File -FilePath .\Version.txt
Start-Process powershell .\GUI.ps1
}
} else {
if ($Gedownloaded){
Set-Location .\TuningPack\
Start-Process powershell .\GUI.ps1
}
}