mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 09:19:18 +01:00
Changed Welcome Dialog to download installer to temp file while downloading
This commit is contained in:
parent
7485af045e
commit
7a24df13b9
@ -16,6 +16,7 @@ namespace DS4WinWPF.DS4Forms
|
||||
private const string InstallerDL =
|
||||
"https://github.com/ViGEm/ViGEmBus/releases/download/v1.16.112/ViGEmBus_Setup_1.16.115.exe";
|
||||
private const string InstFileName = "ViGEmBus_Setup_1.16.115.exe";
|
||||
private string tempInstFileName;
|
||||
|
||||
Process monitorProc;
|
||||
NonFormTimer monitorTimer;
|
||||
@ -30,6 +31,8 @@ namespace DS4WinWPF.DS4Forms
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
tempInstFileName = DS4Windows.Global.exedirpath + $"\\{InstFileName}.tmp";
|
||||
}
|
||||
|
||||
private void FinishedBtn_Click(object sender, RoutedEventArgs e)
|
||||
@ -44,6 +47,11 @@ namespace DS4WinWPF.DS4Forms
|
||||
File.Delete(DS4Windows.Global.exedirpath + $"\\{InstFileName}");
|
||||
}
|
||||
|
||||
if (File.Exists(tempInstFileName))
|
||||
{
|
||||
File.Delete(tempInstFileName);
|
||||
}
|
||||
|
||||
ViGEmDownloadLaunch();
|
||||
|
||||
/*WebClient wb = new WebClient();
|
||||
@ -67,9 +75,17 @@ namespace DS4WinWPF.DS4Forms
|
||||
});
|
||||
|
||||
string filename = DS4Windows.Global.exedirpath + $"\\{InstFileName}";
|
||||
using (var downloadStream = new FileStream(filename, FileMode.CreateNew))
|
||||
bool success = false;
|
||||
using (var downloadStream = new FileStream(tempInstFileName, FileMode.CreateNew))
|
||||
{
|
||||
HttpResponseMessage response = await App.requestClient.GetAsync(InstallerDL, downloadStream, progress);
|
||||
HttpResponseMessage response = await App.requestClient.GetAsync(InstallerDL,
|
||||
downloadStream, progress);
|
||||
success = response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
File.Move(tempInstFileName, filename);
|
||||
}
|
||||
|
||||
if (File.Exists(DS4Windows.Global.exedirpath + $"\\{InstFileName}"))
|
||||
|
Loading…
Reference in New Issue
Block a user