add download for driver
This commit is contained in:
parent
58bef7537f
commit
0760600d47
6 changed files with 47 additions and 47 deletions
|
@ -46,10 +46,10 @@
|
|||
|
||||
<ui:Button x:Name="buttonSkipVersion" Margin="8,0,0,0" Grid.Column="1" Appearance="Secondary" Icon="ArrowForward24" Visibility="Collapsed" ToolTip="{x:Static p:Resources.ui_skipversion}" Click="buttonSkipVersion_Click" />
|
||||
|
||||
<ui:Button x:Name="buttonDownload" Margin="8,0,0,0" MinWidth="100" Grid.Column="2" Appearance="Primary" Icon="ArrowDownload24" Visibility="Collapsed" />
|
||||
<ui:Button x:Name="buttonDownload" Margin="8,0,0,0" MinWidth="100" Grid.Column="2" Appearance="Primary" Icon="ArrowDownload24" Visibility="Collapsed" Click="buttonDownload_Click" />
|
||||
</Grid>
|
||||
|
||||
<ProgressBar Grid.Row="2" Value="0" Visibility="Collapsed"/>
|
||||
<ProgressBar x:Name="progressbarDownload" Grid.Row="2" Value="0" Visibility="Collapsed"/>
|
||||
<!-- This is for later automatic downloading. Todo! -->
|
||||
|
||||
<Grid Margin="0,12,0,0" Grid.Row="3">
|
||||
|
|
|
@ -1,24 +1,13 @@
|
|||
using Microsoft.Build.Framework.XamlTypes;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Threading;
|
||||
using Windows.ApplicationModel.VoiceCommands;
|
||||
|
||||
namespace EnvyUpdate
|
||||
{
|
||||
|
@ -261,12 +250,6 @@ namespace EnvyUpdate
|
|||
}
|
||||
}
|
||||
|
||||
private void buttonDL_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Debug.LogToFile("INFO Opening download page.");
|
||||
Process.Start(gpuURL);
|
||||
}
|
||||
|
||||
private void switchStudioDriver_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (File.Exists(GlobalVars.exedirectory + "sd.envy"))
|
||||
|
@ -358,5 +341,37 @@ namespace EnvyUpdate
|
|||
infoBarStatus.Message = Properties.Resources.ui_message_update;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDownload_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
progressbarDownload.Visibility = Visibility.Visible;
|
||||
buttonDownload.IsEnabled = false;
|
||||
|
||||
Thread thread = new Thread(() => {
|
||||
WebClient client = new WebClient();
|
||||
client.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0";
|
||||
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
|
||||
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
|
||||
client.DownloadFileAsync(new Uri(Util.GetDirectDownload(gpuURL)), Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe"));
|
||||
});
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
||||
{
|
||||
double bytesIn = double.Parse(e.BytesReceived.ToString());
|
||||
double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
|
||||
double percentage = bytesIn / totalBytes * 100;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() => {
|
||||
progressbarDownload.Value = int.Parse(Math.Truncate(percentage).ToString());
|
||||
}));
|
||||
}
|
||||
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(new Action(() => {
|
||||
progressbarDownload.Visibility = Visibility.Collapsed;
|
||||
buttonDownload.Icon = Wpf.Ui.Common.SymbolRegular.CheckmarkCircle24;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
using Microsoft.Build.Framework.XamlTypes;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Net;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Wpf.Ui.Controls.Interfaces;
|
||||
|
||||
namespace EnvyUpdate
|
||||
{
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace EnvyUpdate
|
||||
{
|
||||
|
|
|
@ -573,10 +573,15 @@ namespace EnvyUpdate
|
|||
}
|
||||
}
|
||||
|
||||
public static void DownloadFile(string fileURL, string savePath)
|
||||
public static string GetDirectDownload(string gpuUrl)
|
||||
{
|
||||
//TODO Implement downloading
|
||||
//TODO implement progress bar
|
||||
string webcontent;
|
||||
using (var wc = new WebClient())
|
||||
webcontent = wc.DownloadString(gpuUrl);
|
||||
|
||||
string directUrl = Regex.Match(webcontent, "\\/Windows\\/\\d+\\.\\d+\\/[\\w\\d\\/\\-\\.]*exe").Value;
|
||||
directUrl = "https://us.download.nvidia.com" + directUrl;
|
||||
return directUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ If you want to help me develop EnvyUpdate, you can start by creating issues with
|
|||
|
||||
* [TinyNvidiaUpdateChecker](https://github.com/ElPumpo/TinyNvidiaUpdateChecker) - a command line update checker and installer. Inspired EnvyUpdate to begin with.
|
||||
* [nvidia-update](https://github.com/ZenitH-AT/nvidia-update) - a Powershell script to check for driver updates
|
||||
* [Disable-Nvidia-Telemtry](https://github.com/NateShoffner/Disable-Nvidia-Telemetry) - does pretty much what the name says. It disables Nvidia Telemetry.
|
||||
* [Disable-Nvidia-Telemetry](https://github.com/NateShoffner/Disable-Nvidia-Telemetry) - does pretty much what the name says. It disables Nvidia Telemetry.
|
||||
* [NVCleanInstall](https://www.techpowerup.com/nvcleanstall/) - a closed-source application by TechPowerUp which does quite a lot of cool things.
|
||||
|
||||
EnvyUpdate is not a replacement for any of these tools. I will still try to implement as many features in EnvyUpdate as possible while keeping the simple interface and as little settings as possible.
|
||||
|
|
Reference in a new issue