diff --git a/.gitignore b/.gitignore
index 87d5d82..b248083 100644
--- a/.gitignore
+++ b/.gitignore
@@ -347,6 +347,3 @@ healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
-
-# Markdown backups
-*.md.backup
\ No newline at end of file
diff --git a/EnvyUpdate.sln b/EnvyUpdate.sln
index d029e8c..5225e06 100644
--- a/EnvyUpdate.sln
+++ b/EnvyUpdate.sln
@@ -1,41 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.6.33829.357
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvyUpdate", "EnvyUpdate\EnvyUpdate.csproj", "{1BF2468D-9579-462D-9153-4836E9C8721F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - ignoregpu|Any CPU = Debug - ignoregpu|Any CPU
- Debug - ignoregpu|x64 = Debug - ignoregpu|x64
- Debug - ignoregpu|x86 = Debug - ignoregpu|x86
Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|Any CPU.ActiveCfg = Debug - ignoregpu|Any CPU
{1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|Any CPU.Build.0 = Debug - ignoregpu|Any CPU
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|x64.ActiveCfg = Debug - ignoregpu|x64
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|x64.Build.0 = Debug - ignoregpu|x64
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|x86.ActiveCfg = Debug - ignoregpu|x86
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug - ignoregpu|x86.Build.0 = Debug - ignoregpu|x86
{1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|x64.ActiveCfg = Debug|x64
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|x64.Build.0 = Debug|x64
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|x86.ActiveCfg = Debug|x86
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Debug|x86.Build.0 = Debug|x86
{1BF2468D-9579-462D-9153-4836E9C8721F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BF2468D-9579-462D-9153-4836E9C8721F}.Release|Any CPU.Build.0 = Release|Any CPU
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|x64.ActiveCfg = Release|x64
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|x64.Build.0 = Release|x64
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|x86.ActiveCfg = Release|x86
- {1BF2468D-9579-462D-9153-4836E9C8721F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/EnvyUpdate/App.config b/EnvyUpdate/App.config
index 1027a8f..8dde225 100644
--- a/EnvyUpdate/App.config
+++ b/EnvyUpdate/App.config
@@ -1,34 +1,34 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
\ No newline at end of file
diff --git a/EnvyUpdate/App.xaml b/EnvyUpdate/App.xaml
index de53160..414c0d4 100644
--- a/EnvyUpdate/App.xaml
+++ b/EnvyUpdate/App.xaml
@@ -2,14 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EnvyUpdate"
- xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
StartupUri="MainWindow.xaml">
-
-
-
-
-
-
+
diff --git a/EnvyUpdate/App.xaml.cs b/EnvyUpdate/App.xaml.cs
index 185bc1d..35ec068 100644
--- a/EnvyUpdate/App.xaml.cs
+++ b/EnvyUpdate/App.xaml.cs
@@ -1,5 +1,4 @@
-using Microsoft.Toolkit.Uwp.Notifications;
-using System;
+using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
@@ -7,8 +6,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
-using Windows.Foundation.Collections;
-using Wpf.Ui.Markup;
namespace EnvyUpdate
{
@@ -17,19 +14,5 @@ namespace EnvyUpdate
///
public partial class App : Application
{
- protected override void OnStartup(StartupEventArgs e)
- {
- // Listen to notification activation
- ToastNotificationManagerCompat.OnActivated += ToastNotificationManagerCompat_OnActivated;
- }
-
- private void ToastNotificationManagerCompat_OnActivated(ToastNotificationActivatedEventArgsCompat e)
- {
- // Need to dispatch to UI thread if performing UI operations
- Application.Current.Dispatcher.Invoke(delegate
- {
- Util.ShowMain();
- });
- }
}
}
diff --git a/EnvyUpdate/DashboardPage.xaml b/EnvyUpdate/DashboardPage.xaml
deleted file mode 100644
index 546b018..0000000
--- a/EnvyUpdate/DashboardPage.xaml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/EnvyUpdate/DashboardPage.xaml.cs b/EnvyUpdate/DashboardPage.xaml.cs
deleted file mode 100644
index f53ef42..0000000
--- a/EnvyUpdate/DashboardPage.xaml.cs
+++ /dev/null
@@ -1,509 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Windows;
-using System.Windows.Threading;
-using MessageBox = System.Windows.MessageBox;
-
-namespace EnvyUpdate
-{
- ///
- /// Interaction logic for Dashboard.xaml
- ///
- public partial class DashboardPage
- {
- private string localDriv = null;
- private string onlineDriv = null;
- private string gpuURL = null;
- private string skippedVer = null;
- private DateTime lastFileChanged = DateTime.MinValue;
-
- public DashboardPage()
- {
- InitializeComponent();
-
- if (GlobalVars.startMinimized)
- Application.Current.MainWindow.Hide(); // Hide only AFTER initializing dashboard page, otherwise tray icon doesn't work
-
- if (Debug.isFake)
- localDriv = Debug.LocalDriv();
- else
- localDriv = Util.GetLocDriv();
-
- Debug.LogToFile("INFO Local driver version: " + localDriv);
-
- if (localDriv != null)
- {
- Debug.LogToFile("INFO Local driver version already known, updating info without reloading.");
- UpdateLocalVer(false);
- }
-
- Debug.LogToFile("INFO Detecting driver type.");
-
- if (Debug.isFake)
- textblockLocalType.Text = "DCH (Debug)";
- else if (Util.IsDCH())
- textblockLocalType.Text = "DCH";
- else
- textblockLocalType.Text = "Standard";
-
- Debug.LogToFile("INFO Done detecting driver type: " + textblockLocalType.Text);
-
- // Check for startup shortcut
- if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EnvyUpdate.lnk")))
- {
- Debug.LogToFile("INFO Autostart is enabled.");
- switchAutostart.IsChecked = true;
- switchAutostart_Click(null, null); //Automatically recreate shortcut to account for moved EXE.
- }
-
- DispatcherTimer Dt = new DispatcherTimer();
- Dt.Tick += new EventHandler(Dt_Tick);
- // Check for new updates every 5 hours.
- Dt.Interval = new TimeSpan(5, 0, 0);
- Dt.Start();
- Debug.LogToFile("INFO Started check timer.");
-
- string watchDirPath = Path.Combine(Environment.ExpandEnvironmentVariables("%ProgramW6432%"), "NVIDIA Corporation\\Installer2\\InstallerCore");
- if (Directory.Exists(watchDirPath))
- {
- GlobalVars.monitoringInstall = true;
-
- var driverFileChangedWatcher = new FileSystemWatcher(watchDirPath);
- driverFileChangedWatcher.NotifyFilter = NotifyFilters.Attributes
- | NotifyFilters.CreationTime
- | NotifyFilters.FileName
- | NotifyFilters.LastAccess
- | NotifyFilters.LastWrite
- | NotifyFilters.Size;
- driverFileChangedWatcher.Changed += DriverFileChanged;
-
- driverFileChangedWatcher.Filter = "*.dll";
- driverFileChangedWatcher.IncludeSubdirectories = false;
- driverFileChangedWatcher.EnableRaisingEvents = true;
- Debug.LogToFile("INFO Started update file system watcher.");
- }
- else
- Debug.LogToFile("WARN Could not start update file system watcher. Path not found: " + watchDirPath);
-
- Load();
- }
-
- private void Dt_Tick(object sender, EventArgs e)
- {
- Load();
- }
-
- private void Load()
- {
- if (Util.GetDTID() == 18)
- {
- Debug.LogToFile("INFO Found studio driver.");
- switchStudioDriver.IsChecked = true;
- }
- else
- {
- Debug.LogToFile("INFO Found standard driver.");
- switchStudioDriver.IsChecked = false;
- }
-
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory,"skip.envy")))
- {
- Debug.LogToFile("INFO Found version skip config.");
- skippedVer = File.ReadLines(Path.Combine(GlobalVars.saveDirectory, "skip.envy")).First();
- }
-
- // This little bool check is necessary for debug fake mode.
- if (Debug.isFake)
- {
- localDriv = Debug.LocalDriv();
- cardLocal.Header = localDriv;
- textblockGPUName.Text = Debug.GPUname();
- }
-
- try
- {
- Debug.LogToFile("INFO Trying to get GPU update URL.");
- gpuURL = Util.GetGpuUrl();
- }
- catch (ArgumentException)
- {
- Debug.LogToFile("WARN Could not get GPU update URL, trying again with non-studio driver.");
- try
- {
- // disable SD and try with GRD
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "sd.envy")))
- {
- File.Delete(Path.Combine(GlobalVars.saveDirectory, "sd.envy"));
- }
-
- gpuURL = Util.GetGpuUrl(); //try again with GRD
- MessageBox.Show(Properties.Resources.ui_studionotsupported);
- switchStudioDriver.IsChecked = false;
- }
- catch (ArgumentNullException)
- {
- MessageBox.Show("ERROR: Could not get list of GPU models from Nvidia, please check your network connection.\nOtherwise, please report this issue on GitHub.");
- Environment.Exit(11);
- }
- catch (ArgumentException e)
- {
- // Now we have a problem.
- Debug.LogToFile("FATAL Invalid API response from Nvidia. Attempted API call: " + e.Message);
- MessageBox.Show("ERROR: Invalid API response from Nvidia. Please file an issue on GitHub.\nAttempted API call:\n" + e.Message);
- Environment.Exit(10);
- }
- }
-
- using (var c = new WebClient())
- {
- Debug.LogToFile("INFO Trying to get newest driver version.");
- string pContent = c.DownloadString(gpuURL);
- var pattern = @"Windows\/\d{3}\.\d{2}";
- Regex rgx = new Regex(pattern);
- var matches = rgx.Matches(pContent);
- onlineDriv = Regex.Replace(Convert.ToString(matches[0]), "Windows/", "");
- cardOnline.Header = onlineDriv;
- Debug.LogToFile("INFO Got online driver version: " + onlineDriv);
- }
-
- string correctLocalDriv;
- string correctOnlineDriv;
-
- try
- {
- float.Parse(onlineDriv);
- correctLocalDriv = localDriv;
- correctOnlineDriv = onlineDriv;
- }
- catch (FormatException)
- {
- Debug.LogToFile("INFO Caught FormatException, assuming locale workaround is necessary.");
- //Thank you locales. Some languages need , instead of . for proper parsing
- correctLocalDriv = localDriv.Replace('.', ',');
- correctOnlineDriv = onlineDriv.Replace('.', ',');
- }
-
- if (float.Parse(correctLocalDriv) < float.Parse(correctOnlineDriv))
- {
- Debug.LogToFile("INFO Local version is older than online. Setting UI...");
- SetInfoBar(false);
- buttonDownload.Visibility = Visibility.Visible;
- buttonSkipVersion.Visibility = Visibility.Visible;
- if (skippedVer == null)
- {
- buttonSkipVersion.ToolTip = Properties.Resources.ui_skipversion;
- buttonSkipVersion.IsEnabled = true;
- }
- else
- {
- buttonSkipVersion.IsEnabled = false;
- buttonSkipVersion.ToolTip = Properties.Resources.ui_skipped;
- }
-
- Debug.LogToFile("INFO UI set.");
-
- if (skippedVer != onlineDriv)
- {
- if (GlobalVars.autoDownload)
- {
- if (buttonDownload.IsVisible)
- {
- Debug.LogToFile("INFO Auto-Downloading driver.");
- buttonDownload_Click(null, null);
- }
- }
-
- Debug.LogToFile("INFO Showing update popup notification.");
- Notify.ShowDrivUpdatePopup();
- }
- }
- else
- {
- Debug.LogToFile("INFO Local version is up to date.");
- buttonSkipVersion.Visibility = Visibility.Collapsed;
- SetInfoBar(true);
- }
-
- //Check for different version than skipped version
- if (skippedVer != null && skippedVer != onlineDriv)
- {
- Debug.LogToFile("INFO Skipped version is surpassed, deleting setting.");
- skippedVer = null;
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "skip.envy")))
- File.Delete(Path.Combine(GlobalVars.saveDirectory, "skip.envy"));
- buttonSkipVersion.ToolTip = Properties.Resources.ui_skipversion;
- buttonSkipVersion.IsEnabled = true;
- buttonSkipVersion.Visibility = Visibility.Visible;
- }
-
- // Check if update file already exists and display install button instead
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe")))
- {
- Debug.LogToFile("INFO Found downloaded driver installer, no need to redownload.");
- buttonDownload.Visibility = Visibility.Collapsed;
- buttonInstall.Visibility = Visibility.Visible;
- }
- }
-
- private void switchStudioDriver_Unchecked(object sender, RoutedEventArgs e)
- {
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "sd.envy")))
- {
- Debug.LogToFile("INFO Switching to game ready driver.");
- File.Delete(Path.Combine(GlobalVars.saveDirectory, "sd.envy"));
- Load();
- }
- }
-
- private void switchStudioDriver_Checked(object sender, RoutedEventArgs e)
- {
- if (!File.Exists(Path.Combine(GlobalVars.saveDirectory, "sd.envy")))
- {
- Debug.LogToFile("INFO Switching to studio driver.");
- File.Create(Path.Combine(GlobalVars.saveDirectory, "sd.envy")).Close();
- Load();
- }
- }
-
- private void switchAutostart_Click(object sender, RoutedEventArgs e)
- {
- if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EnvyUpdate.lnk")))
- {
- Debug.LogToFile("INFO Removing autostart entry.");
- File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EnvyUpdate.lnk"));
- }
- if (switchAutostart.IsChecked == true)
- {
- Debug.LogToFile("INFO Creating autostart entry.");
- Util.CreateShortcut("EnvyUpdate", Environment.GetFolderPath(Environment.SpecialFolder.Startup), GlobalVars.pathToAppExe, "NVidia Update Checker", "/minimize");
- }
- }
-
- private void buttonSkipVersion_Click(object sender, RoutedEventArgs e)
- {
- Debug.LogToFile("INFO Skipping version.");
- skippedVer = onlineDriv;
- File.WriteAllText(Path.Combine(GlobalVars.saveDirectory, "skip.envy"), onlineDriv);
- buttonSkipVersion.IsEnabled = false;
- buttonSkipVersion.ToolTip = Properties.Resources.ui_skipped;
- MessageBox.Show(Properties.Resources.skip_confirm);
- }
-
- private void UpdateLocalVer(bool reloadLocalDriv = true)
- {
- Debug.LogToFile("INFO Updating local driver version in UI.");
- if (reloadLocalDriv)
- {
- Debug.LogToFile("INFO Reloading local driver version.");
- localDriv = Util.GetLocDriv();
- }
- cardLocal.Header = localDriv;
- if (GlobalVars.isMobile)
- textblockGPUName.Text = Util.GetGPUName(false) + " (mobile)";
- else
- textblockGPUName.Text = Util.GetGPUName(false);
- }
-
- void DriverFileChanged(object sender, FileSystemEventArgs e)
- {
- if (!GlobalVars.isInstalling && (DateTime.UtcNow.Subtract(lastFileChanged).TotalMinutes > 1))
- {
- Debug.LogToFile("INFO Watched driver file changed! Reloading data.");
- System.Threading.Thread.Sleep(10000);
- lastFileChanged = DateTime.UtcNow;
- Application.Current.Dispatcher.Invoke(delegate
- {
- UpdateLocalVer();
- Load();
- });
- }
- }
-
- private void CardOnline_Click(object sender, RoutedEventArgs e)
- {
- Debug.LogToFile("INFO Opening download page.");
- Process.Start(gpuURL);
- }
-
- private void SetInfoBar (bool good)
- {
- if (good)
- {
- infoBarStatus.Severity = Wpf.Ui.Controls.InfoBarSeverity.Success;
- infoBarStatus.Title = Properties.Resources.ui_info_uptodate;
- infoBarStatus.Message = Properties.Resources.ui_message_good;
- }
- else
- {
- infoBarStatus.Severity = Wpf.Ui.Controls.InfoBarSeverity.Warning;
- infoBarStatus.Title = Properties.Resources.ui_info_outdated;
- infoBarStatus.Message = Properties.Resources.ui_message_update;
- }
- }
-
- private void buttonDownload_Click(object sender, RoutedEventArgs e)
- {
- if (GlobalVars.isDownloading)
- {
- Debug.LogToFile("WARN A download is already running.");
- ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Danger, Wpf.Ui.Common.SymbolRegular.ErrorCircle24, Properties.Resources.info_download_running, Properties.Resources.info_download_running_title);
- }
- else
- {
- progressbarDownload.Visibility = Visibility.Visible;
- buttonDownload.IsEnabled = false;
- GlobalVars.isDownloading = true;
-
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading")))
- {
- Debug.LogToFile("WARN Found previous unfinished download, retrying.");
- File.Delete(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading"));
- }
- Thread thread = new Thread(() => {
- using (WebClient client = new WebClient())
- {
- client.Headers["User-Agent"] = GlobalVars.useragent;
- client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
- client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
- client.DownloadFileAsync(new Uri(Util.GetDirectDownload(gpuURL)), Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading"));
- }
- });
- thread.Start();
- Debug.LogToFile("INFO Started installer download.");
- }
- }
-
- 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(() => {
- buttonDownload.IsEnabled = true;
- progressbarDownload.Visibility = Visibility.Collapsed;
- GlobalVars.isDownloading = false;
- }));
- if (e.Error == null)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => {
- ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Success, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle24, Properties.Resources.info_download_success, Properties.Resources.info_download_success_title);
- buttonDownload.Visibility = Visibility.Collapsed;
- buttonInstall.Visibility = Visibility.Visible;
- Debug.LogToFile("INFO Download successful.");
- }));
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe")))
- File.Delete(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe"));
- File.Move(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading"), Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe"));
- }
- else
- {
- File.Delete(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe.downloading"));
- Application.Current.Dispatcher.Invoke(new Action(() => {
- ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Danger, Wpf.Ui.Common.SymbolRegular.ErrorCircle24, Properties.Resources.info_download_error, Properties.Resources.info_download_error_title);
- Debug.LogToFile("INFO Download NOT successful. Error: " + e.Error.ToString());
- }));
- }
- }
- private void buttonInstall_Click(object sender, RoutedEventArgs e)
- {
- buttonInstall.IsEnabled = false;
- GlobalVars.isInstalling = true;
- string sevenZipPath = Util.GetSevenZip();
-
- ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Info, Wpf.Ui.Common.SymbolRegular.FolderZip24, Properties.Resources.info_extracting, Properties.Resources.info_extracting_title);
-
- string filePath = Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe");
- string destinationDir = Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-extracted");
-
- if (!Directory.Exists(destinationDir))
- Directory.CreateDirectory(destinationDir);
-
- Debug.LogToFile("INFO Starting extraction of driver files.");
-
- Process process = new Process();
- ProcessStartInfo startInfo = new ProcessStartInfo
- {
- WindowStyle = ProcessWindowStyle.Minimized,
- WorkingDirectory = destinationDir,
- FileName = sevenZipPath,
- Arguments = "x -aoa -y \"" + filePath + "\" Display.Driver Display.Nview Display.Optimus HDAudio MSVCR NVI2 NVPCF PhysX PPC ShieldWirelessController EULA.txt ListDevices.txt setup.cfg setup.exe"
- };
- process.EnableRaisingEvents = true;
- process.StartInfo = startInfo;
- process.Exited += new EventHandler(ExtractionFinished);
- process.Start();
- }
-
- private void ExtractionFinished(object sender, EventArgs e)
- {
- string extractedPath = Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-extracted");
- Application.Current.Dispatcher.Invoke(new Action(() => {
- ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Success, Wpf.Ui.Common.SymbolRegular.FolderZip24, Properties.Resources.info_extract_complete, Properties.Resources.info_extract_complete_title);
- }));
- Debug.LogToFile("INFO Extraction exited, deleting 7-zip executable.");
-
- File.Delete(Path.Combine(GlobalVars.saveDirectory, "7zr.exe"));
-
- Util.CleanInstallConfig(Path.Combine(extractedPath, "setup.cfg"));
-
- Debug.LogToFile("Starting driver setup.");
-
- Process process = new Process();
- ProcessStartInfo startInfo = new ProcessStartInfo
- {
- WindowStyle = ProcessWindowStyle.Normal,
- WorkingDirectory = extractedPath,
- FileName = "setup.exe",
- Arguments = "-passive -noreboot -noeula"
- };
- process.EnableRaisingEvents = true;
- process.StartInfo = startInfo;
- process.Exited += new EventHandler(InstallFinished);
- process.Start();
- }
-
- private void InstallFinished(object sender, EventArgs e)
- {
- Application.Current.Dispatcher.Invoke(new Action(() => {
- ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Success, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle24, Properties.Resources.info_install_complete, Properties.Resources.info_install_complete_title);
- buttonInstall.IsEnabled = true;
- buttonInstall.Visibility = Visibility.Collapsed;
- buttonDownload.IsEnabled = true;
- buttonDownload.Visibility = Visibility.Collapsed;
- }));
-
- Debug.LogToFile("INFO Driver setup complete. Cleaning up setup files.");
-
- File.Delete(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-nvidia-installer.exe"));
- Directory.Delete(Path.Combine(GlobalVars.saveDirectory, onlineDriv + "-extracted"), true);
- GlobalVars.isInstalling = false;
- Application.Current.Dispatcher.Invoke(delegate
- {
- UpdateLocalVer();
- Load();
- });
- }
-
- private void ShowSnackbar(Wpf.Ui.Common.ControlAppearance appearance, Wpf.Ui.Common.SymbolRegular icon, string message = "", string title = "")
- {
- snackbarInfo.Appearance = appearance;
- snackbarInfo.Icon = icon;
- snackbarInfo.Title = title;
- snackbarInfo.Message = message;
- snackbarInfo.Show();
- }
- }
-}
diff --git a/EnvyUpdate/Debug.cs b/EnvyUpdate/Debug.cs
index 35e6e04..f2f8e91 100644
--- a/EnvyUpdate/Debug.cs
+++ b/EnvyUpdate/Debug.cs
@@ -1,31 +1,22 @@
using System;
-using System.Diagnostics;
using System.IO;
using System.Linq;
-using System.Security.Policy;
namespace EnvyUpdate
{
class Debug
{
- public static bool isFake = false;
-#if DEBUG
- public static bool isVerbose = true;
-#else
- public static bool isVerbose = false;
-#endif
-
public static int LoadFakeIDs(string idType)
{
/*
- * Usage: Supply /debug flag to exe. Imitates a GTX 1080ti on Win10 x64 DCH Game Ready Driver.
+ * Usage: Supply /debug flag to exe. Imitates a GTX 1080ti on Win10 x64 non-dch Game Ready Driver.
*/
switch (idType)
{
case "psid":
- return 127;
+ return 101;
case "pfid":
- return 999;
+ return 845;
case "osid":
return 57;
case "dtcid":
@@ -43,18 +34,7 @@ namespace EnvyUpdate
public static string GPUname()
{
- return "Nvidia GeForce RTX 4080 (debug)";
- }
-
- public static void LogToFile(string content)
- {
- if (isVerbose)
- {
- if (GlobalVars.useAppdata)
- File.AppendAllText(Path.Combine(GlobalVars.appdata, "envyupdate.log"), content + "\n");
- else
- File.AppendAllText(Path.Combine(GlobalVars.directoryOfExe, "envyupdate.log"), content + "\n");
- }
+ return "Nvidia GeForce GTX 1080ti (debug)";
}
}
}
diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj
index cc7331b..d4b1588 100644
--- a/EnvyUpdate/EnvyUpdate.csproj
+++ b/EnvyUpdate/EnvyUpdate.csproj
@@ -1,5 +1,7 @@
+
+
Debug
@@ -8,7 +10,7 @@
WinExe
EnvyUpdate
EnvyUpdate
- v4.8
+ v4.7.2
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
@@ -16,8 +18,6 @@
true
- false
-
publish\
true
Disk
@@ -30,6 +30,7 @@
true
0
1.0.0.%2a
+ false
false
true
@@ -72,76 +73,50 @@
app.manifest
-
- true
- bin\x86\Debug\
- DEBUG;TRACE
- full
- x86
- 7.3
- prompt
- true
-
-
- bin\x86\Release\
- TRACE
- true
- pdbonly
- x86
- 7.3
- prompt
- true
-
-
- true
- bin\x86\Debug - ignoregpu\
- DEBUG;TRACE
- full
- x86
- 7.3
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
- true
- bin\x64\Debug\
- DEBUG;TRACE
- full
- x64
- 7.3
- prompt
- true
-
-
- bin\x64\Release\
- TRACE
- true
- pdbonly
- x64
- 7.3
- prompt
- true
-
-
- true
- bin\x64\Debug - ignoregpu\
- DEBUG;TRACE
- full
- x64
- 7.3
- prompt
- MinimumRecommendedRules.ruleset
- true
-
+
+ ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll
+
+
+ ..\packages\Hardcodet.NotifyIcon.Wpf.1.1.0\lib\net472\Hardcodet.NotifyIcon.Wpf.dll
+
+
+ ..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
+
+
+ ..\packages\Notifications.Wpf.0.1.1\lib\net461\Notifications.Wpf.dll
+
+
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+ ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
+
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Text.Encodings.Web.6.0.0\lib\net461\System.Text.Encodings.Web.dll
+
+
+ ..\packages\System.Text.Json.6.0.1\lib\net461\System.Text.Json.dll
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
+ ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
+
@@ -162,25 +137,21 @@
+
+ InfoWindow.xaml
+
-
- DashboardPage.xaml
-
-
- True
- True
- Licenses.resx
-
Resources.de.resx
True
True
-
- SettingsPage.xaml
-
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
@@ -193,14 +164,6 @@
MainWindow.xaml
Code
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
@@ -216,10 +179,6 @@
Settings.settings
True
-
- ResXFileCodeGenerator
- Licenses.Designer.cs
-
PublicResXFileCodeGenerator
Resources.de.Designer.cs
@@ -229,6 +188,7 @@
Resources.Designer.cs
+
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -266,27 +226,16 @@
false
-
-
- 5.7.0
-
-
- 6.8.1
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- 7.1.3
-
-
- 2.2.0
-
-
- 8.0.4
-
-
- 2.1.0
-
-
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EnvyUpdate/FodyWeavers.xsd b/EnvyUpdate/FodyWeavers.xsd
index 05e92c1..44a5374 100644
--- a/EnvyUpdate/FodyWeavers.xsd
+++ b/EnvyUpdate/FodyWeavers.xsd
@@ -17,16 +17,6 @@
A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
-
-
- A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
-
-
-
-
- A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
-
-
A list of unmanaged 32 bit assembly names to include, delimited with line breaks.
@@ -53,16 +43,6 @@
Controls if .pdbs for reference assemblies are also embedded.
-
-
- Controls if runtime assemblies are also embedded.
-
-
-
-
- Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.
-
-
Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.
@@ -93,16 +73,6 @@
A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.
-
-
- A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
-
-
-
-
- A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.
-
-
A list of unmanaged 32 bit assembly names to include, delimited with |.
diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs
index f52b4af..6cc8e8b 100644
--- a/EnvyUpdate/GlobalVars.cs
+++ b/EnvyUpdate/GlobalVars.cs
@@ -6,20 +6,10 @@ namespace EnvyUpdate
class GlobalVars
{
public static bool isMobile = false;
- public static readonly string pathToAppExe = System.Reflection.Assembly.GetEntryAssembly().Location;
- public static readonly string directoryOfExe = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
- public static string saveDirectory = directoryOfExe;
+ public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location;
+ public static readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
- public static readonly string legacyAppdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
- public static readonly string appdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "EnvyUpdate_Data");
+ public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
- public static bool monitoringInstall = false;
- public static bool startMinimized = false;
- public static bool isInstalling = false;
- public static readonly string useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0";
- public static bool useAppdata = false;
- public static bool hasWrite = true;
- public static bool autoDownload = false;
- public static bool isDownloading = false;
}
}
diff --git a/EnvyUpdate/InfoWindow.xaml b/EnvyUpdate/InfoWindow.xaml
new file mode 100644
index 0000000..6673c08
--- /dev/null
+++ b/EnvyUpdate/InfoWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
diff --git a/EnvyUpdate/InfoWindow.xaml.cs b/EnvyUpdate/InfoWindow.xaml.cs
new file mode 100644
index 0000000..1686eee
--- /dev/null
+++ b/EnvyUpdate/InfoWindow.xaml.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Windows;
+using System.Windows.Input;
+using System.IO;
+
+namespace EnvyUpdate
+{
+ ///
+ /// Interaction logic for InfoWindow.xaml
+ ///
+ public partial class InfoWindow : Window
+ {
+ public InfoWindow()
+ {
+ InitializeComponent();
+
+ System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
+ System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
+ string version = fvi.FileVersion;
+
+ labelVer.Content += " " + version;
+ }
+
+ private void ButtonWeb_Click(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("https://github.com/fyr77/EnvyUpdate/");
+ }
+ }
+}
diff --git a/EnvyUpdate/MainWindow.xaml b/EnvyUpdate/MainWindow.xaml
index 5015f14..4074828 100644
--- a/EnvyUpdate/MainWindow.xaml
+++ b/EnvyUpdate/MainWindow.xaml
@@ -1,64 +1,31 @@
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs
index 6522ee3..8748023 100644
--- a/EnvyUpdate/MainWindow.xaml.cs
+++ b/EnvyUpdate/MainWindow.xaml.cs
@@ -1,18 +1,26 @@
-using Microsoft.Toolkit.Uwp.Notifications;
-using Microsoft.Win32;
-using System;
+using System;
+using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Net;
+using System.Text.RegularExpressions;
using System.Windows;
+using System.Windows.Media;
+using System.Windows.Threading;
namespace EnvyUpdate
{
///
/// Interaction logic for MainWindow.xaml
///
- public partial class MainWindow
+ public partial class MainWindow : Window
{
+ private string localDriv = null;
+ private string onlineDriv = null;
+ private string gpuURL = null;
private string[] arguments = null;
+ private bool isDebug = false;
+ private string skippedVer = null;
public MainWindow()
{
@@ -28,127 +36,289 @@ namespace EnvyUpdate
// This is necessary, since .NET throws an exception if you check for a non-existant arg.
}
- if (!Util.HasWritePermissions())
- {
- if (!Directory.Exists(GlobalVars.appdata))
- Directory.CreateDirectory(GlobalVars.appdata);
-
- GlobalVars.hasWrite = false;
- }
-
- if (Directory.Exists(GlobalVars.appdata))
- {
- GlobalVars.useAppdata = true;
- GlobalVars.saveDirectory = GlobalVars.appdata;
- }
-
- // Check if Debug file exists
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log")))
- {
- Debug.isVerbose = true;
- Debug.LogToFile("------");
- Debug.LogToFile("INFO Found log file, will start logging to this.");
- }
-
- Debug.LogToFile("INFO Starting EnvyUpdate, version " + System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion);
- Debug.LogToFile("INFO Save directory: " + GlobalVars.saveDirectory);
-
- // Check if running on supported Windows version.
- if (Environment.OSVersion.Version.Major < 10)
- {
- Debug.LogToFile("FATAL Unsupported OS version, terminating.");
- MessageBox.Show(Properties.Resources.unsupported_os);
- Environment.Exit(1);
- }
-
// Check if EnvyUpdate is already running
if (Util.IsInstanceOpen("EnvyUpdate"))
{
- Debug.LogToFile("FATAL Found another instance, terminating.");
-
MessageBox.Show(Properties.Resources.instance_already_running);
Environment.Exit(1);
}
- // Check dark theme
- AdjustTheme();
- SystemEvents.UserPreferenceChanged += AdjustTheme;
+ // Delete installed legacy versions
+ if (Directory.Exists(GlobalVars.appdata))
+ UninstallAll();
- // Delete installed legacy versions, required for people upgrading from very old versions.
- if (Directory.Exists(GlobalVars.legacyAppdata))
+ GlobalVars.isMobile = Util.IsMobile();
+
+ if (Util.IsDCH())
+ textblockLocalType.Text = "DCH";
+ else
+ textblockLocalType.Text = "Standard";
+
+ string locDriv = Util.GetLocDriv();
+ if (locDriv != null)
{
- Debug.LogToFile("INFO Found legacy appdata installation, uninstalling.");
- Util.UninstallAll();
+ localDriv = locDriv;
+ textblockGPU.Text = locDriv;
+ if (GlobalVars.isMobile)
+ textblockGPUName.Text = Util.GetGPUName(false) + " (mobile)";
+ else
+ textblockGPUName.Text = Util.GetGPUName(false);
+ }
+ else
+ {
+ if (arguments.Contains("/debug"))
+ {
+ MessageBox.Show("Debug mode!");
+ isDebug = true;
+ }
+ else
+ {
+ MessageBox.Show(Properties.Resources.no_compatible_gpu);
+ Environment.Exit(255);
+ }
}
- // Allow for running using a fake graphics card if no nvidia card is present.
- if (arguments.Contains("/fake"))
+ // Check for startup shortcut
+ if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EnvyUpdate.lnk")))
{
- Debug.isFake = true;
- Debug.LogToFile("WARN Faking GPU with debug info.");
- }
- else if (!Util.IsNvidia())
- {
- Debug.LogToFile("FATAL No supported GPU found, terminating.");
- MessageBox.Show(Properties.Resources.no_compatible_gpu);
- Environment.Exit(255);
+ chkAutostart.IsChecked = true;
+ chkAutostart_Click(null, null); //Automatically recreate shortcut to account for moved EXE.
}
//Check if launched as miminized with arg
if (arguments.Contains("/minimize"))
{
- Debug.LogToFile("INFO Launching minimized.");
WindowState = WindowState.Minimized;
- GlobalVars.startMinimized = true;
+ Hide();
}
- //Check for old unfinished downloads
- string[] leftovers = Directory.GetFiles(GlobalVars.directoryOfExe, "*-nvidia-installer.exe.downloading");
- if (leftovers.Length > 0)
+ DispatcherTimer Dt = new DispatcherTimer();
+ Dt.Tick += new EventHandler(Dt_Tick);
+ // Check for new updates every 5 hours.
+ Dt.Interval = new TimeSpan(5, 0, 0);
+ Dt.Start();
+ Load();
+ }
+
+ private void Dt_Tick(object sender, EventArgs e)
+ {
+ Load();
+ }
+
+ private void buttonHelp_Click(object sender, RoutedEventArgs e)
+ {
+ InfoWindow infoWin = new InfoWindow();
+ infoWin.ShowDialog();
+ }
+
+ private async void Load()
+ {
+ int psid = 0;
+ int pfid = 0;
+ int osid = 0;
+ int dtcid = 0;
+ int dtid = 0;
+ //TODO: Make a list of languages and match OS language to driver
+ //int langid;
+
+ if (File.Exists(GlobalVars.exepath + "sd.envy"))
+ radioSD.IsChecked = true;
+ else
+ radioGRD.IsChecked = true;
+
+ if (File.Exists(GlobalVars.exepath + "skip.envy"))
+ skippedVer = File.ReadLines(GlobalVars.exepath + "skip.envy").First();
+
+ // This little bool check is necessary for debug mode on systems without an Nvidia GPU.
+ if (!isDebug)
{
- foreach (string leftover in leftovers)
+ psid = Util.GetIDs("psid");
+ pfid = Util.GetIDs("pfid");
+ osid = Util.GetIDs("osid");
+ dtcid = Util.GetDTCID();
+ //dtid = Util.GetDTID();
+ }
+ else
+ {
+ psid = Debug.LoadFakeIDs("psid");
+ pfid = Debug.LoadFakeIDs("pfid");
+ osid = Debug.LoadFakeIDs("osid");
+ dtcid = Debug.LoadFakeIDs("dtcid");
+ dtid = Debug.LoadFakeIDs("dtid");
+ localDriv = Debug.LocalDriv();
+ textblockGPU.Text = localDriv;
+ textblockGPUName.Text = Debug.GPUname();
+ }
+
+ //Temporary Studio Driver override logic until I have figured out how to detect it automatically
+ //TODO
+ try
+ {
+ if (radioSD.IsChecked == true)
+ dtid = 18;
+ else
+ dtid = 1;
+ }
+ catch (NullReferenceException)
+ { }
+
+ gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString() + "&dtcid=" + dtcid.ToString() + "&dtid=" + dtid.ToString(); // + "&lid=" + langid.ToString();
+ WebClient c = new WebClient();
+ gpuURL = c.DownloadString(gpuURL);
+ if (!gpuURL.Contains("://"))
+ {
+ //This means a relative link was used.
+ gpuURL = "https://www.nvidia.com/Download/" + gpuURL;
+ }
+ string pContent = c.DownloadString(gpuURL);
+ var pattern = @"Windows\/\d{3}\.\d{2}";
+ Regex rgx = new Regex(pattern);
+ var matches = rgx.Matches(pContent);
+ onlineDriv = Regex.Replace(Convert.ToString(matches[0]), "Windows/", "");
+ textblockOnline.Text = onlineDriv;
+ c.Dispose();
+
+ try
+ {
+ if (float.Parse(localDriv) < float.Parse(onlineDriv))
{
- Debug.LogToFile("INFO Deleting leftover download " + leftover);
- File.Delete(leftover);
+ textblockOnline.Foreground = Brushes.Red;
+ buttonDL.IsEnabled = true;
+ if (skippedVer == null)
+ {
+ buttonSkip.Content = Properties.Resources.ui_skipversion;
+ buttonSkip.IsEnabled = true;
+ }
+ else
+ buttonSkip.Content = Properties.Resources.ui_skipped;
+ if (skippedVer != onlineDriv)
+ Notify.ShowDrivUpdatePopup();
+ }
+ else
+ {
+ buttonSkip.IsEnabled = false;
+ textblockOnline.Foreground = Brushes.Green;
+ }
+ }
+ catch (FormatException)
+ {
+ //Thank you locales. Some languages need , instead of . for proper parsing
+ string cLocalDriv = localDriv.Replace('.', ',');
+ string cOnlineDriv = onlineDriv.Replace('.', ',');
+ if (float.Parse(cLocalDriv) < float.Parse(cOnlineDriv))
+ {
+ textblockOnline.Foreground = Brushes.Red;
+ buttonDL.IsEnabled = true;
+ if (skippedVer == null)
+ buttonSkip.IsEnabled = true;
+ else
+ buttonSkip.Content = Properties.Resources.ui_skipped;
+ if (skippedVer != onlineDriv)
+ Notify.ShowDrivUpdatePopup();
+ }
+ else
+ {
+ buttonSkip.IsEnabled = false;
+ textblockOnline.Foreground = Brushes.Green;
}
}
- GlobalVars.isMobile = Util.IsMobile();
- Debug.LogToFile("INFO Mobile: " + GlobalVars.isMobile);
-
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")))
+ //Check for different version than skipped version
+ if (skippedVer != onlineDriv)
{
- Debug.LogToFile("INFO Auto-download is enabled.");
- GlobalVars.autoDownload = true;
+ skippedVer = null;
+ if (File.Exists(GlobalVars.exepath + "skip.envy"))
+ File.Delete(GlobalVars.exepath + "skip.envy");
+ buttonSkip.Content = Properties.Resources.ui_skipversion;
+ buttonSkip.IsEnabled = true;
}
}
+
+ private void buttonDL_Click(object sender, RoutedEventArgs e)
+ {
+ Process.Start(gpuURL);
+ }
+
+ private void TaskbarIcon_TrayLeftMouseDown(object sender, RoutedEventArgs e)
+ {
+ Util.ShowMain();
+ }
+
private void Window_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
- Debug.LogToFile("INFO Window was minimized, closing to tray.");
Hide();
}
}
+ public void UninstallAll()
+ {
+ if (File.Exists(GlobalVars.startup + "\\EnvyUpdate.lnk"))
+ {
+ File.Delete(GlobalVars.startup + "\\EnvyUpdate.lnk");
+ }
+
+ if (File.Exists(GlobalVars.startmenu + "\\EnvyUpdate.lnk"))
+ {
+ File.Delete(GlobalVars.startmenu + "\\EnvyUpdate.lnk");
+ }
+ if ((GlobalVars.exepath == GlobalVars.appdata) && File.Exists(GlobalVars.appdata + "EnvyUpdate.exe"))
+ {
+ MessageBox.Show(Properties.Resources.uninstall_legacy_message);
+ Util.SelfDelete();
+ }
+ else if (Directory.Exists(GlobalVars.appdata))
+ {
+ Directory.Delete(GlobalVars.appdata, true);
+ }
+ }
+
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
- Debug.LogToFile("INFO Uninstalling notifications and shutting down.");
- ToastNotificationManagerCompat.Uninstall(); // Uninstall notifications to prevent issues with the app being portable.
- Application.Current.Shutdown();
- }
-
- private void AdjustTheme(object sender = null, UserPreferenceChangedEventArgs e = null)
- {
- if (Util.IsDarkTheme())
- Wpf.Ui.Appearance.Theme.Apply(Wpf.Ui.Appearance.ThemeType.Dark, Wpf.Ui.Appearance.BackgroundType.Mica);
+ if (MessageBox.Show(Properties.Resources.exit_confirm, "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
+ Application.Current.Shutdown();
else
- Wpf.Ui.Appearance.Theme.Apply(Wpf.Ui.Appearance.ThemeType.Light, Wpf.Ui.Appearance.BackgroundType.Mica);
+ e.Cancel = true;
}
- private void NotifyIcon_LeftClick(Wpf.Ui.Controls.NotifyIcon sender, RoutedEventArgs e)
+ private void radioGRD_Checked(object sender, RoutedEventArgs e)
{
- Util.ShowMain();
+ if (File.Exists(GlobalVars.exepath + "sd.envy"))
+ {
+ File.Delete(GlobalVars.exepath + "sd.envy");
+ Load();
+ }
+ }
+
+ private void radioSD_Checked(object sender, RoutedEventArgs e)
+ {
+ if (!File.Exists(GlobalVars.exepath + "sd.envy"))
+ {
+ File.Create(GlobalVars.exepath + "sd.envy").Close();
+ Load();
+ }
+ }
+
+ private void chkAutostart_Click(object sender, RoutedEventArgs e)
+ {
+ if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EnvyUpdate.lnk")))
+ {
+ File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EnvyUpdate.lnk"));
+ }
+ if (chkAutostart.IsChecked == true)
+ {
+ Util.CreateShortcut("EnvyUpdate", Environment.GetFolderPath(Environment.SpecialFolder.Startup), GlobalVars.exeloc, "NVidia Update Checker", "/minimize");
+ }
+ }
+
+ private void buttonSkip_Click(object sender, RoutedEventArgs e)
+ {
+ skippedVer = onlineDriv;
+ File.WriteAllText(GlobalVars.exepath + "skip.envy", onlineDriv);
+ buttonSkip.IsEnabled = false;
+ buttonSkip.Content = Properties.Resources.ui_skipped;
+ MessageBox.Show(Properties.Resources.skip_confirm);
}
}
}
\ No newline at end of file
diff --git a/EnvyUpdate/Notify.cs b/EnvyUpdate/Notify.cs
index d889163..7afaecf 100644
--- a/EnvyUpdate/Notify.cs
+++ b/EnvyUpdate/Notify.cs
@@ -1,4 +1,4 @@
-using Microsoft.Toolkit.Uwp.Notifications;
+using Notifications.Wpf;
namespace EnvyUpdate
{
@@ -6,16 +6,14 @@ namespace EnvyUpdate
{
public static void ShowDrivUpdatePopup()
{
- try
+ var notificationManager = new NotificationManager();
+
+ notificationManager.Show(new NotificationContent
{
- var toast = new ToastContentBuilder();
- toast.AddText(Properties.Resources.update_popup_message);
- toast.Show();
- }
- catch (System.Exception ex)
- {
- Debug.LogToFile("WARN Could not show notification. Error: " + ex.Message);
- }
+ Title = "EnvyUpdate",
+ Message = Properties.Resources.update_popup_message,
+ Type = NotificationType.Information
+ }, onClick: Util.ShowMain);
}
}
}
\ No newline at end of file
diff --git a/EnvyUpdate/Properties/AssemblyInfo.cs b/EnvyUpdate/Properties/AssemblyInfo.cs
index b9441b1..a6fa859 100644
--- a/EnvyUpdate/Properties/AssemblyInfo.cs
+++ b/EnvyUpdate/Properties/AssemblyInfo.cs
@@ -6,11 +6,11 @@ using System.Windows;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EnvyUpdate")]
-[assembly: AssemblyDescription("Small update checker application for Nvidia GPUs")]
+[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("fyr77")]
+[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnvyUpdate")]
-[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.6")]
-[assembly: AssemblyFileVersion("3.6")]
+[assembly: AssemblyVersion("2.13")]
+[assembly: AssemblyFileVersion("2.13")]
diff --git a/EnvyUpdate/Properties/Licenses.Designer.cs b/EnvyUpdate/Properties/Licenses.Designer.cs
deleted file mode 100644
index ef7ff51..0000000
--- a/EnvyUpdate/Properties/Licenses.Designer.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace EnvyUpdate.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Licenses {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Licenses() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EnvyUpdate.Properties.Licenses", typeof(Licenses).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to GNU LGPL information
- /// --------------------
- ///This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
- ///
- ///This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public [rest of string was truncated]";.
- ///
- internal static string _7zip {
- get {
- return ResourceManager.GetString("7zip", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The MIT License
- ///
- ///Copyright (c) 2012 Simon Cropp and contributors
- ///
- ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- ///
- ///The ab [rest of string was truncated]";.
- ///
- internal static string CosturaFody {
- get {
- return ResourceManager.GetString("CosturaFody", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to MIT License
- ///
- ///Copyright (c) 2019-2023 Jakob Senkl
- ///
- ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- ///
- ///The above copyright no [rest of string was truncated]";.
- ///
- internal static string EnvyUpdate {
- get {
- return ResourceManager.GetString("EnvyUpdate", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to MIT License
- ///
- ///Copyright (c) Simon Cropp
- ///
- ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- ///
- ///The above copyright notice and t [rest of string was truncated]";.
- ///
- internal static string Fody {
- get {
- return ResourceManager.GetString("Fody", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The MIT License (MIT)
- ///
- ///Copyright (c) MarcStan
- ///
- ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- ///
- ///The above copyright notic [rest of string was truncated]";.
- ///
- internal static string ResourceEmbedder {
- get {
- return ResourceManager.GetString("ResourceEmbedder", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to # Windows Community Toolkit
- ///
- ///Copyright © .NET Foundation and Contributors
- ///
- ///All rights reserved.
- ///
- ///## MIT License (MIT)
- ///
- ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished [rest of string was truncated]";.
- ///
- internal static string WindowsCommunityToolkit {
- get {
- return ResourceManager.GetString("WindowsCommunityToolkit", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to MIT License
- ///
- ///Copyright (c) 2021-2023 Leszek Pomianowski and WPF UI Contributors. https://dev.lepo.co/
- ///
- ///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject t [rest of string was truncated]";.
- ///
- internal static string wpfui {
- get {
- return ResourceManager.GetString("wpfui", resourceCulture);
- }
- }
- }
-}
diff --git a/EnvyUpdate/Properties/Licenses.resx b/EnvyUpdate/Properties/Licenses.resx
deleted file mode 100644
index 6fe2a2b..0000000
--- a/EnvyUpdate/Properties/Licenses.resx
+++ /dev/null
@@ -1,199 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GNU LGPL information
- --------------------
-This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You can receive a copy of the GNU Lesser General Public License from http://www.gnu.org/
-
-
- The MIT License
-
-Copyright (c) 2012 Simon Cropp and contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
- MIT License
-
-Copyright (c) 2019-2023 Jakob Senkl
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
- MIT License
-
-Copyright (c) Simon Cropp
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
- The MIT License (MIT)
-
-Copyright (c) MarcStan
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
- # Windows Community Toolkit
-
-Copyright © .NET Foundation and Contributors
-
-All rights reserved.
-
-## MIT License (MIT)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
- MIT License
-
-Copyright (c) 2021-2023 Leszek Pomianowski and WPF UI Contributors. https://dev.lepo.co/
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
\ No newline at end of file
diff --git a/EnvyUpdate/Properties/Resources.Designer.cs b/EnvyUpdate/Properties/Resources.Designer.cs
index 466a9c0..e7f0cc3 100644
--- a/EnvyUpdate/Properties/Resources.Designer.cs
+++ b/EnvyUpdate/Properties/Resources.Designer.cs
@@ -69,15 +69,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to An error occurred attempting to install the new version. Please enable logging in the settings and report the issue on GitHub!.
- ///
- public static string error_installing {
- get {
- return ResourceManager.GetString("error_installing", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Exit EnvyUpdate?.
///
@@ -87,114 +78,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to There was a problem downloading the driver installer. Please try again..
- ///
- public static string info_download_error {
- get {
- return ResourceManager.GetString("info_download_error", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Error while downloading.
- ///
- public static string info_download_error_title {
- get {
- return ResourceManager.GetString("info_download_error_title", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to A download process is already running!.
- ///
- public static string info_download_running {
- get {
- return ResourceManager.GetString("info_download_running", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Download running.
- ///
- public static string info_download_running_title {
- get {
- return ResourceManager.GetString("info_download_running_title", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Driver installer successfully downloaded..
- ///
- public static string info_download_success {
- get {
- return ResourceManager.GetString("info_download_success", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Download successful.
- ///
- public static string info_download_success_title {
- get {
- return ResourceManager.GetString("info_download_success_title", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The driver files have finished extracting..
- ///
- public static string info_extract_complete {
- get {
- return ResourceManager.GetString("info_extract_complete", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Extraction complete.
- ///
- public static string info_extract_complete_title {
- get {
- return ResourceManager.GetString("info_extract_complete_title", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The driver files are being extracted. This could take a few minutes..
- ///
- public static string info_extracting {
- get {
- return ResourceManager.GetString("info_extracting", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Extracting driver files.
- ///
- public static string info_extracting_title {
- get {
- return ResourceManager.GetString("info_extracting_title", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The installation of the new driver version was completed..
- ///
- public static string info_install_complete {
- get {
- return ResourceManager.GetString("info_install_complete", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Update finished.
- ///
- public static string info_install_complete_title {
- get {
- return ResourceManager.GetString("info_install_complete_title", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Preference reset..
///
@@ -231,15 +114,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to No.
- ///
- public static string no {
- get {
- return ResourceManager.GetString("no", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to No NVIDIA GPU found. Application will exit..
///
@@ -267,51 +141,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to Download.
- ///
- public static string ui_download {
- get {
- return ResourceManager.GetString("ui_download", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Save files to AppData.
- ///
- public static string ui_enable_appdata {
- get {
- return ResourceManager.GetString("ui_enable_appdata", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Download updates automatically.
- ///
- public static string ui_enable_autodownload {
- get {
- return ResourceManager.GetString("ui_enable_autodownload", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Enable logging to file.
- ///
- public static string ui_enable_logging {
- get {
- return ResourceManager.GetString("ui_enable_logging", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Home.
- ///
- public static string ui_home {
- get {
- return ResourceManager.GetString("ui_home", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to DCH driver.
///
@@ -330,24 +159,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to Update available..
- ///
- public static string ui_info_outdated {
- get {
- return ResourceManager.GetString("ui_info_outdated", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Up to date..
- ///
- public static string ui_info_uptodate {
- get {
- return ResourceManager.GetString("ui_info_uptodate", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to EnvyUpdate website.
///
@@ -366,15 +177,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to Licenses.
- ///
- public static string ui_licenses {
- get {
- return ResourceManager.GetString("ui_licenses", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Local driver version:.
///
@@ -393,24 +195,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to All good..
- ///
- public static string ui_message_good {
- get {
- return ResourceManager.GetString("ui_message_good", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to New driver found..
- ///
- public static string ui_message_update {
- get {
- return ResourceManager.GetString("ui_message_update", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Online driver version:.
///
@@ -420,24 +204,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to Open website.
- ///
- public static string ui_openwebsite {
- get {
- return ResourceManager.GetString("ui_openwebsite", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Settings.
- ///
- public static string ui_settings {
- get {
- return ResourceManager.GetString("ui_settings", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Version skipped.
///
@@ -456,15 +222,6 @@ namespace EnvyUpdate.Properties {
}
}
- ///
- /// Looks up a localized string similar to Studio Driver is not supported by this graphics card..
- ///
- public static string ui_studionotsupported {
- get {
- return ResourceManager.GetString("ui_studionotsupported", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Are you sure you want to uninstall EnvyUpdate?.
///
@@ -493,30 +250,12 @@ namespace EnvyUpdate.Properties {
}
///
- /// Looks up a localized string similar to Your operating system is not supported by EnvyUpdate. Windows 10 or later is required..
- ///
- public static string unsupported_os {
- get {
- return ResourceManager.GetString("unsupported_os", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to A new driver update is available for your graphics card..
+ /// Looks up a localized string similar to A new driver update is available for your graphics card. Click for more info..
///
public static string update_popup_message {
get {
return ResourceManager.GetString("update_popup_message", resourceCulture);
}
}
-
- ///
- /// Looks up a localized string similar to Yes.
- ///
- public static string yes {
- get {
- return ResourceManager.GetString("yes", resourceCulture);
- }
- }
}
}
diff --git a/EnvyUpdate/Properties/Resources.de.resx b/EnvyUpdate/Properties/Resources.de.resx
index b5a18f5..171c831 100644
--- a/EnvyUpdate/Properties/Resources.de.resx
+++ b/EnvyUpdate/Properties/Resources.de.resx
@@ -120,48 +120,9 @@
NVIDIA Aktualisierungsanwendung.
-
- Ein Fehler ist bei der Installation aufgetreten. Bitte aktivieren Sie den Log und melden Sie den Fehler auf GitHub!
-
EnvyUpdate schließen?
-
- Fehler beim Herunterladen der Treiber-Installationsdatei. Bitte versuchen Sie es erneut.
-
-
- Fehler beim Herunterladen
-
-
- Ein Downloadvorgang läuft bereits!
-
-
- Download läuft
-
-
- Treiber-Installationsdatei erfolgreich heruntergeladen.
-
-
- Herunterladen erfolgreich abgeschlossen
-
-
- Die Treiberdateien werden nun extrahiert. Dies könnte einige Minuten dauern.
-
-
- Dateien werden extrahiert
-
-
- Die Treiberdateien wurden vollständig extrahiert.
-
-
- Extrahierung abgeschlossen
-
-
- Die Installation der neuen Treiberversion wurde abgeschlossen.
-
-
- Update abgeschlossen
-
Einstellung zurückgesetzt.
@@ -174,9 +135,6 @@
Neue Version von EnvyUpdate gefunden. Die Anwendung wird neu starten.\nDies wird wahrscheinlich einige Sekunden dauern.
-
- Nein
-
Keine NVIDIA GPU gefunden. EnvyUpdate wird sich nun schließen.
@@ -186,72 +144,33 @@
Beim Start von Windows ausführen
-
- Herunterladen
-
-
- Programmdaten in AppData speichern
-
-
- Updates automatisch herunterladen
-
-
- Programm-Log in Datei schreiben
-
-
- Start
-
DCH Treiber
Mobile Grafikkarte (Laptop, etc)?
-
- Aktualisierung verfügbar.
-
-
- Aktuell.
-
EnvyUpdate Webseite
Installieren
-
- Lizenzen
-
Lokale Treiberversion:
Lokaler Treibertyp:
-
- Alles in Ordnung.
-
-
- Neue Treiberversion gefunden.
-
Online Treiberversion:
-
- Webseite öffnen
-
-
- Einstellungen
-
Version übersprungen
Diese Version überspringen
-
- Studio Treiber wird von dieser Grafikkarte nicht unterstützt.
-
Sind Sie sich sicher, dass Sie EnvyUpdate deinstallieren wollen?
@@ -261,13 +180,7 @@
Aufgrund eines Programmfehlers musste EnvyUpdate deinstalliert werden. Bitte laden Sie die neuste Version erneut manuell herunter.
-
- Diese Betriebssystemversion wird von EnvyUpdate nicht unterstützt. Windows 10 oder neuer wird vorausgesetzt.
-
- Eine neue Treiberversion ist verfügbar.
-
-
- Ja
+ Eine neue Treiberversion ist verfügbar. Hier klicken für mehr Info.
\ No newline at end of file
diff --git a/EnvyUpdate/Properties/Resources.resx b/EnvyUpdate/Properties/Resources.resx
index 2623dae..6036388 100644
--- a/EnvyUpdate/Properties/Resources.resx
+++ b/EnvyUpdate/Properties/Resources.resx
@@ -120,48 +120,9 @@
NVIDIA Updater Application.
-
- An error occurred attempting to install the new version. Please enable logging in the settings and report the issue on GitHub!
-
Exit EnvyUpdate?
-
- There was a problem downloading the driver installer. Please try again.
-
-
- Error while downloading
-
-
- A download process is already running!
-
-
- Download running
-
-
- Driver installer successfully downloaded.
-
-
- Download successful
-
-
- The driver files are being extracted. This could take a few minutes.
-
-
- Extracting driver files
-
-
- The driver files have finished extracting.
-
-
- Extraction complete
-
-
- The installation of the new driver version was completed.
-
-
- Update finished
-
Preference reset.
@@ -174,9 +135,6 @@
New version of EnvyUpdate found. Application will restart.\nThis will probably take a few seconds.
-
- No
-
No NVIDIA GPU found. Application will exit.
@@ -186,72 +144,33 @@
Run at Windows startup
-
- Download
-
-
- Save files to AppData
-
-
- Download updates automatically
-
-
- Enable logging to file
-
-
- Home
-
DCH driver
Mobile GPU (Laptop, etc)?
-
- Update available.
-
-
- Up to date.
-
EnvyUpdate website
Install
-
- Licenses
-
Local driver version:
Local driver type:
-
- All good.
-
-
- New driver found.
-
Online driver version:
-
- Open website
-
-
- Settings
-
Version skipped
Skip this version
-
- Studio Driver is not supported by this graphics card.
-
Are you sure you want to uninstall EnvyUpdate?
@@ -261,13 +180,7 @@
EnvyUpdate must be uninstalled because of an application bug. Please download the most recent version again.
-
- Your operating system is not supported by EnvyUpdate. Windows 10 or later is required.
-
- A new driver update is available for your graphics card.
-
-
- Yes
+ A new driver update is available for your graphics card. Click for more info.
\ No newline at end of file
diff --git a/EnvyUpdate/Properties/Settings.Designer.cs b/EnvyUpdate/Properties/Settings.Designer.cs
index dbccb96..0585bd8 100644
--- a/EnvyUpdate/Properties/Settings.Designer.cs
+++ b/EnvyUpdate/Properties/Settings.Designer.cs
@@ -8,17 +8,21 @@
//
//------------------------------------------------------------------------------
-namespace EnvyUpdate.Properties {
-
-
+namespace EnvyUpdate.Properties
+{
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
+
+ public static Settings Default
+ {
+ get
+ {
return defaultInstance;
}
}
diff --git a/EnvyUpdate/SettingsPage.xaml b/EnvyUpdate/SettingsPage.xaml
deleted file mode 100644
index ab6f973..0000000
--- a/EnvyUpdate/SettingsPage.xaml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/EnvyUpdate/SettingsPage.xaml.cs b/EnvyUpdate/SettingsPage.xaml.cs
deleted file mode 100644
index e65aa94..0000000
--- a/EnvyUpdate/SettingsPage.xaml.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-using System;
-using System.IO;
-using System.Windows;
-
-namespace EnvyUpdate
-{
- ///
- /// Interaction logic for SettingsPage.xaml
- ///
- public partial class SettingsPage
- {
- public SettingsPage()
- {
- InitializeComponent();
-
- System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
- System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
- string version = fvi.FileVersion;
-
- textBlockVer.Text = version;
- if (GlobalVars.monitoringInstall)
- textBlockVer.FontStyle = FontStyles.Italic;
-
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log")) || File.Exists(Path.Combine(GlobalVars.appdata, "envyupdate.log")))
- chkLog.IsChecked = true;
-
- if (GlobalVars.useAppdata)
- chkAppdata.IsChecked = true;
-
- if (!GlobalVars.hasWrite)
- chkAppdata.IsEnabled = false;
-
- if (GlobalVars.autoDownload)
- chkAutodl.IsChecked = true;
-
- if (GlobalVars.isDownloading)
- {
- chkAppdata.IsEnabled = false;
- }
- else
- chkAppdata.IsEnabled = true;
-
- textBoxLicEnvyupdate.Text = Properties.Licenses.EnvyUpdate;
- textBoxLicFody.Text = Properties.Licenses.Fody;
- textBoxLicCostura.Text = Properties.Licenses.CosturaFody;
- textBoxLicResourceembedder.Text = Properties.Licenses.ResourceEmbedder;
- textBoxLicWindowscommunitytoolkit.Text = Properties.Licenses.WindowsCommunityToolkit;
- textBoxLicWpfui.Text = Properties.Licenses.wpfui;
- textBoxLic7zip.Text = Properties.Licenses._7zip;
- }
-
- private void CardWeb_Click(object sender, RoutedEventArgs e)
- {
- Debug.LogToFile("INFO Launching website.");
- System.Diagnostics.Process.Start("https://github.com/fyr77/EnvyUpdate/");
- }
-
- private void chkLog_Checked(object sender, RoutedEventArgs e)
- {
- if (!Debug.isVerbose)
- {
- Debug.isVerbose = true;
- Debug.LogToFile("------");
- Debug.LogToFile("INFO Enabled logging to file. Restart Application to see full startup log.");
- }
- }
-
- private void chkLog_Unchecked(object sender, RoutedEventArgs e)
- {
- if (Debug.isVerbose)
- {
- Debug.LogToFile("INFO Disabled logging to file.");
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log")))
- File.Move(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log"), Path.Combine(GlobalVars.saveDirectory, "envyupdate." + DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".log"));
- Debug.isVerbose = false;
- }
- }
-
- private void chkAppdata_Checked(object sender, RoutedEventArgs e)
- {
- if (!Directory.Exists(GlobalVars.appdata))
- Directory.CreateDirectory(GlobalVars.appdata);
-
- GlobalVars.useAppdata = true;
- GlobalVars.saveDirectory = GlobalVars.appdata;
- Util.MoveFilesToAppdata();
-
- Debug.LogToFile("INFO Switched to AppData directory.");
- }
-
- private void chkAppdata_Unchecked(object sender, RoutedEventArgs e)
- {
- GlobalVars.useAppdata = false;
- GlobalVars.saveDirectory = GlobalVars.directoryOfExe;
-
- if (Directory.Exists(GlobalVars.appdata))
- {
- Util.MoveFilesToExe();
- Directory.Delete(GlobalVars.appdata, true);
- }
-
- Debug.LogToFile("INFO Switched to EXE directory.");
- }
-
- private void chkAutodl_Checked(object sender, RoutedEventArgs e)
- {
- GlobalVars.autoDownload = true;
- if (!File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")))
- {
- File.Create(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"));
- }
- }
-
- private void chkAutodl_Unchecked(object sender, RoutedEventArgs e)
- {
- GlobalVars.autoDownload = false;
- if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")))
- {
- File.Delete(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"));
- }
- }
- }
-}
diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs
index 8a504cd..47ae34d 100644
--- a/EnvyUpdate/Util.cs
+++ b/EnvyUpdate/Util.cs
@@ -1,5 +1,4 @@
using IWshRuntimeLibrary;
-using Microsoft.Build.Framework.XamlTypes;
using Microsoft.Win32;
using System;
using System.Diagnostics;
@@ -8,6 +7,7 @@ using System.Linq;
using System.Management;
using System.Net;
using System.Text.RegularExpressions;
+using System.Threading.Tasks;
using System.Windows;
using System.Xml.Linq;
@@ -27,8 +27,6 @@ namespace EnvyUpdate
// query local driver version
try
{
- Debug.LogToFile("INFO Looking for driver version in ManagementObjects");
-
foreach (ManagementObject obj in new ManagementObjectSearcher("SELECT * FROM Win32_VideoController").Get())
{
if (obj["Description"].ToString().ToLower().Contains("nvidia"))
@@ -37,16 +35,12 @@ namespace EnvyUpdate
OfflineGPUVersion = OfflineGPUVersion.Substring(Math.Max(0, OfflineGPUVersion.Length - 5));
OfflineGPUVersion = OfflineGPUVersion.Substring(0, 3) + "." + OfflineGPUVersion.Substring(3); // add dot
foundGpu = true;
- Debug.LogToFile("INFO Found driver in ManagementObjects.");
break;
}
}
if (!foundGpu)
- {
- Debug.LogToFile("WARN Did NOT find driver in ManagementObjects.");
throw new InvalidDataException();
- }
return OfflineGPUVersion;
}
@@ -56,22 +50,6 @@ namespace EnvyUpdate
}
}
- ///
- /// Check for existence of Nvidia GPU
- ///
- ///
- public static bool IsNvidia()
- {
- Debug.LogToFile("INFO Checking for existence of Nvidia GPU.");
-
- foreach (ManagementObject obj in new ManagementObjectSearcher("SELECT * FROM Win32_VideoController").Get())
- {
- if (obj["Description"].ToString().ToLower().Contains("nvidia"))
- return true;
- }
- return false;
- }
-
///
/// Creates a standard Windows shortcut.
///
@@ -90,7 +68,6 @@ namespace EnvyUpdate
shortcut.Arguments = arguments;
shortcut.Description = description;
shortcut.TargetPath = targetFileLocation;
- Debug.LogToFile("INFO Saving shortcut link.");
shortcut.Save();
}
///
@@ -123,7 +100,6 @@ namespace EnvyUpdate
{
Application.Current.MainWindow.Show();
Application.Current.MainWindow.WindowState = WindowState.Normal;
- Application.Current.MainWindow.Activate();
}
///
@@ -131,11 +107,13 @@ namespace EnvyUpdate
///
public static void SelfDelete()
{
+ string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
+
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
- WorkingDirectory = GlobalVars.legacyAppdata,
+ WorkingDirectory = appdata,
FileName = "cmd.exe",
Arguments = "/C timeout 5 && del EnvyUpdate.exe"
};
@@ -144,12 +122,12 @@ namespace EnvyUpdate
Environment.Exit(2);
}
- public static int GetIDs(string IDtype, bool retry = true)
+ public static int GetIDs(string IDtype)
{
+ // TODO: check for 2 occurences of GPU - if yes ask if mobile!!!
string xmlcontent = null;
int id = -1;
- Debug.LogToFile("INFO Getting Nvidia GPU list...");
using (var wc = new WebClient())
{
switch (IDtype)
@@ -158,57 +136,36 @@ namespace EnvyUpdate
case "pfid":
xmlcontent = wc.DownloadString("https://www.nvidia.com/Download/API/lookupValueSearch.aspx?TypeID=3");
break;
- default:
- break;
- }
- }
-
- Debug.LogToFile("INFO Got Nvidia GPU list.");
- if (xmlcontent == null)
- {
- switch (IDtype)
- {
case "osid":
- id = GetOSID();
- Debug.LogToFile("INFO Got osid: " + id);
+ xmlcontent = wc.DownloadString("https://www.nvidia.com/Download/API/lookupValueSearch.aspx?TypeID=4");
break;
- case "psid":
- case "pfid":
- Debug.LogToFile("WARN GPU list is NULL! This is a possible error source.");
- if (retry)
- {
- Debug.LogToFile("WARN Trying to get ID again.");
- id = GetIDs(IDtype, false);
- }
- else
- {
- Debug.LogToFile("FATAL Could not get GPU list to find IDs.");
- throw new ArgumentNullException();
- }
+ case "langid":
+ xmlcontent = wc.DownloadString("https://www.nvidia.com/Download/API/lookupValueSearch.aspx?TypeID=5");
break;
default:
- Debug.LogToFile("WARN GetIDs was called, but nothing was specified. THIS SHOULD NOT HAPPEN!");
break;
}
}
- else
+ XDocument xDoc = XDocument.Parse(xmlcontent);
+ string gpuName = GetGPUName(true);
+
+ switch (IDtype)
{
- XDocument xDoc = XDocument.Parse(xmlcontent);
- string gpuName = GetGPUName(true);
- switch (IDtype)
- {
- case "psid":
- id = GetValueFromName(xDoc, gpuName, true);
- Debug.LogToFile("INFO Got psid: " + id);
- break;
- case "pfid":
- id = GetValueFromName(xDoc, gpuName, false);
- Debug.LogToFile("INFO Got pfid: " + id);
- break;
- default:
- Debug.LogToFile("WARN GetIDs was called, but nothing was specified.");
- break;
- }
+ case "psid":
+ id = GetValueFromName(xDoc, gpuName, true);
+ break;
+ case "pfid":
+ id = GetValueFromName(xDoc, gpuName, false);
+ break;
+ case "osid":
+ id = GetOSID();
+ break;
+ case "langid":
+ // Currently unsupported, because Nvidia has a weird way of naming languages in their native OR english version.
+ // https://www.nvidia.com/Download/API/lookupValueSearch.aspx?TypeID=5
+ break;
+ default:
+ break;
}
return id;
@@ -226,21 +183,18 @@ namespace EnvyUpdate
int value = 0;
int i = 0;
int value1 = 0;
- int value2 = 0; //Two values are used to cover the eventuality of there being two Nvidia cards (unlikely) in a mobile device
+ int value2 = 0;
var names = xDoc.Descendants("Name");
- foreach (var name in names) // Looping through the XML Doc because the name is not the primary key
+ foreach (var name in names)
{
string sName = name.Value.ToString().ToLower();
- if (sName.Contains(query))
+ if (sName == query)
{
- Debug.LogToFile("INFO Matched GetValueFromName query: " + sName);
string cleanResult = null;
if (psid)
{
- Debug.LogToFile("INFO Getting psid.");
-
if (i == 0)
value1 = int.Parse(name.Parent.FirstAttribute.Value);
else
@@ -248,8 +202,6 @@ namespace EnvyUpdate
}
else
{
- Debug.LogToFile("INFO Getting something other than psid.");
-
string result = name.Parent.Value.ToLower();
int index = result.IndexOf(sName);
cleanResult = (index < 0)
@@ -282,7 +234,6 @@ namespace EnvyUpdate
}
}
-
return value;
}
///
@@ -293,21 +244,31 @@ namespace EnvyUpdate
private static int GetOSID()
{
// This is faster than making a whole web request and searching through XML. This application only supports 8 possible IDs, so they are hardcoded.
- int value;
+ int value = 0;
+ string OS = Environment.OSVersion.Version.Major.ToString() + "." + Environment.OSVersion.Version.Minor.ToString();
- if (Environment.OSVersion.Version.Build < 22000)
+ // Here the 32bit values are used. Later, if the OS is 64bit, we'll add 1, since that is how Nvidia does their IDs.
+ switch (OS)
{
- // This means we are running Windows 10.
- if (Environment.Is64BitOperatingSystem)
- value = 57;
- else
+ case "10.0":
value = 56;
+ break;
+ case "6.1":
+ value = 18;
+ break;
+ case "6.2":
+ value = 27;
+ break;
+ case "6.3":
+ value = 40;
+ break;
+ default:
+ break;
}
- else
- {
- // This must be Windows 11 (for now, until Windows 12 comes along)
- value = 135; // No need to check for 64bit, Win11 can not be 32bit.
- }
+
+ //Simply increment the ID by 1 if OS is 64bit.
+ if (Environment.Is64BitOperatingSystem)
+ value++;
return value;
}
@@ -318,8 +279,6 @@ namespace EnvyUpdate
public static string GetGPUName(bool lower)
{
string GPUName = null;
-
- Debug.LogToFile("INFO Trying to get GPU name from ManagementObjects...");
foreach (ManagementObject obj in new ManagementObjectSearcher("SELECT * FROM Win32_VideoController").Get())
{
//if (obj["Description"].ToString().ToLower().Contains("radeon"))
@@ -337,7 +296,8 @@ namespace EnvyUpdate
{
GPUName = obj["VideoProcessor"].ToString().ToLower();
// Remove any 3GB, 6GB or similar from name. We don't need to know the VRAM to get results.
- GPUName = Regex.Match(GPUName, "(geforce )((.t.? )|(mx ))?\\w*\\d*( ti)?").Value;
+ GPUName = Regex.Replace(GPUName, " \\d+gb", "");
+ GPUName = Regex.Replace(GPUName, "nvidia ", "");
}
else
GPUName = obj["VideoProcessor"].ToString();
@@ -345,7 +305,6 @@ namespace EnvyUpdate
break;
}
}
- Debug.LogToFile("INFO Found GPU name: " + GPUName);
// This should NEVER return null outside of debugging mode, since EnvyUpdate should refuse to start without and Nvidia GPU.
return GPUName;
}
@@ -359,12 +318,10 @@ namespace EnvyUpdate
foreach (ManagementObject obj in new ManagementObjectSearcher("SELECT * FROM Win32_Battery").Get())
{
- Debug.LogToFile("INFO Found Win32_Battery, assuming mobile device.");
result = true;
}
foreach (ManagementObject obj in new ManagementObjectSearcher("SELECT * FROM Win32_PortableBattery").Get())
{
- Debug.LogToFile("INFO Found Win32_PortableBattery, assuming mobile device.");
result = true;
}
@@ -372,14 +329,13 @@ namespace EnvyUpdate
}
///
/// Checks Windows registry for Nvidia DCH Key. If it is present, returns true.
- /// Can also check file system for existence of DLL if registry access fails
+ /// Can also check file system for existance of DLL if registry access fails
///
///
public static bool IsDCH()
{
try
{
- Debug.LogToFile("INFO Trying to find DCH key in registry...");
RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", false);
return nvlddmkm.GetValueNames().Contains("DCHUVen");
}
@@ -387,7 +343,6 @@ namespace EnvyUpdate
{
if (ex.Message == "Object reference not set to an instance of an object." || ex.InnerException is NullReferenceException)
{
- Debug.LogToFile("INFO could not find key. Assuming non-DCH driver.");
// Assume no DCH driver is installed if key is not found.
return false;
}
@@ -395,23 +350,14 @@ namespace EnvyUpdate
{
try
{
- Debug.LogToFile("WARN Could not read registry, probing file system instead...");
//Registry reading error. Check for existance of file nvsvs.dll instead.
if (System.IO.File.Exists(Path.Combine(Environment.SystemDirectory, "nvsvs.dll")))
- {
- Debug.LogToFile("INFO Found DCH driver file.");
return true;
- }
else
- {
- Debug.LogToFile("INFO Did not find DCH driver file. Assuming non-DCH driver.");
return false;
- }
-
}
catch (Exception)
{
- Debug.LogToFile("FATAL Could not probe file system. Error: " + ex.Message);
MessageBox.Show("An error has occured. Please report this on GitHub.\nError:" + ex.Message);
Environment.Exit(20);
return false;
@@ -421,7 +367,12 @@ namespace EnvyUpdate
}
public static int GetDTCID()
{
- return 1; // Force update to DCH drivers
+ int dtcid = 0;
+ if (IsDCH())
+ {
+ dtcid = 1;
+ }
+ return dtcid;
}
public static int GetDTID()
@@ -432,268 +383,13 @@ namespace EnvyUpdate
*/
//TODO: find way to differentiate between driver types
- if (System.IO.File.Exists(Path.Combine(GlobalVars.saveDirectory, "sd.envy")))
- return 18;
- else
- return 1;
+ return 1;
}
- public static string GetGpuUrl()
+ public static void DownloadFile(string fileURL, string savePath)
{
- int psid;
- int pfid;
- int osid;
- int dtcid;
- int dtid;
-
- if (Debug.isFake)
- {
- Debug.LogToFile("INFO Loading fake IDs.");
- psid = Debug.LoadFakeIDs("psid");
- pfid = Debug.LoadFakeIDs("pfid");
- osid = Debug.LoadFakeIDs("osid");
- dtcid = Debug.LoadFakeIDs("dtcid");
- dtid = Debug.LoadFakeIDs("dtid");
- }
- else
- {
- psid = GetIDs("psid");
- pfid = GetIDs("pfid");
- osid = GetIDs("osid");
- dtcid = GetDTCID();
- dtid = GetDTID();
- Debug.LogToFile("INFO Getting GPU URLs. IDs in order psid, pfid, osid, dtcid, dtid: " + psid + ", " + pfid + ", " + osid + ", " + dtcid + ", " + dtid);
- }
- string gpuUrlBuild = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString() + "&dtcid=" + dtcid.ToString() + "&dtid=" + dtid.ToString();
-
- Debug.LogToFile("INFO Built GPU URL: " + gpuUrlBuild);
-
- string gpuUrl;
-
- using (var c = new WebClient())
- {
- gpuUrl = c.DownloadString(gpuUrlBuild);
-
- Debug.LogToFile("INFO Downloaded driver page URL: " + gpuUrl);
-
- if (gpuUrl.Contains("https://") || gpuUrl.Contains("http://"))
- {
- //absolute url
- }
- else if (gpuUrl.Contains("//"))
- {
- //protocol agnostic url
- gpuUrl = "https:" + gpuUrl;
- }
- else if (gpuUrl.StartsWith("driverResults.aspx"))
- {
- //relative url
- gpuUrl = "https://www.nvidia.com/Download/" + gpuUrl;
- }
- else if (gpuUrl.Contains("No certified downloads were found"))
- {
- //configuration not supported
- throw new ArgumentException(gpuUrlBuild);
- }
- else
- {
- //panic.
- Debug.LogToFile("FATAL Unexpected web response: " + gpuUrl);
- MessageBox.Show("ERROR: Invalid API response from Nvidia - unexpected web response. Please file an issue on GitHub.");
- Environment.Exit(10);
- }
- }
-
- return gpuUrl;
- }
-
- public static void UninstallAll()
- {
- if (System.IO.File.Exists(Path.Combine(GlobalVars.startup, "\\EnvyUpdate.lnk")))
- {
- Debug.LogToFile("INFO Deleted startup entry.");
- System.IO.File.Delete(Path.Combine(GlobalVars.startup, "\\EnvyUpdate.lnk"));
- }
-
- if (System.IO.File.Exists(Path.Combine(GlobalVars.startmenu, "\\EnvyUpdate.lnk")))
- {
- Debug.LogToFile("INFO Deleted start menu entry.");
- System.IO.File.Delete(Path.Combine(GlobalVars.startmenu, "\\EnvyUpdate.lnk"));
- }
- if ((GlobalVars.saveDirectory == GlobalVars.legacyAppdata) && System.IO.File.Exists(Path.Combine(GlobalVars.legacyAppdata, "EnvyUpdate.exe")))
- {
- Debug.LogToFile("INFO Deleting EnvyUpdate appdata and self.");
- MessageBox.Show(Properties.Resources.uninstall_legacy_message);
- Util.SelfDelete();
- }
- else if (Directory.Exists(GlobalVars.legacyAppdata))
- {
- Debug.LogToFile("INFO Deleting EnvyUpdate appdata folder");
- Directory.Delete(GlobalVars.legacyAppdata, true);
- }
- }
-
- public static bool IsDarkTheme()
- {
- try
- {
- Debug.LogToFile("INFO Trying to get app theme...");
- int res = (int)Registry.GetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme", -1);
- switch (res)
- {
- case 0:
- Debug.LogToFile("INFO Using dark theme.");
- return true;
- case 1:
- Debug.LogToFile("INFO Using light theme.");
- return false;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- catch (Exception)
- {
- Debug.LogToFile("WARN Could not determine theme. Setting light theme.");
- return false;
- }
- }
-
- public static string GetDirectDownload(string gpuUrl)
- {
- 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;
- }
-
- public static string GetSevenZip()
- {
- string path;
- if (ExistsOnPath("7zg.exe"))
- {
- path = "7zg.exe";
- }
- else
- {
- path = Path.Combine(GlobalVars.saveDirectory, "7zr.exe");
- using (WebClient client = new WebClient())
- {
- client.Headers["User-Agent"] = GlobalVars.useragent;
- client.DownloadFile(new Uri("https://www.7-zip.org/a/7zr.exe"), path);
- }
- Debug.LogToFile("INFO Downloaded 7-zip.");
- }
-
- return path;
- }
-
- public static Process ExtractWithSevenZip(string sevenZipPath, string filePath, string destinationDir)
- {
- if (!Directory.Exists(destinationDir))
- Directory.CreateDirectory(destinationDir);
-
- Process process = new Process();
- ProcessStartInfo startInfo = new ProcessStartInfo
- {
- WindowStyle = ProcessWindowStyle.Minimized,
- WorkingDirectory = destinationDir,
- FileName = sevenZipPath,
- Arguments = "x -aoa -y " + filePath + " Display.Driver Display.Nview Display.Optimus HDAudio MSVCR NVI2 NVPCF PhysX PPC ShieldWirelessController EULA.txt ListDevices.txt setup.cfg setup.exe"
- };
- process.EnableRaisingEvents = true;
- process.StartInfo = startInfo;
- return process;
- }
-
- public static void CleanInstallConfig(string filePath)
- {
- if (!System.IO.File.Exists(filePath))
- {
- Debug.LogToFile("FATAL Driver installer config not found, terminating.");
- MessageBox.Show(Properties.Resources.error_installing);
- Environment.Exit(17);
- }
-
- Debug.LogToFile("INFO Removing GFE content from installer config.");
-
- string outfile = filePath + ".out";
-
- StreamReader sr = new StreamReader(filePath);
- StreamWriter sw = new StreamWriter(outfile);
- string line;
-
- while ((line = sr.ReadLine()) != null)
- {
- if (new[] { "EulaHtmlFile", "FunctionalConsentFile", "PrivacyPolicyFile" }.Any(c => line.Contains(c)))
- {
- continue;
- }
-
- sw.WriteLine(line);
- }
-
- sw.Close();
- sr.Close();
-
- System.IO.File.Delete(filePath);
- System.IO.File.Move(outfile, filePath);
-
- Debug.LogToFile("INFO Finished removing GFE content from installer config.");
- }
-
- private static bool ExistsOnPath(string fileName)
- {
- return GetFullPath(fileName) != null;
- }
-
- private static string GetFullPath(string fileName)
- {
- if (System.IO.File.Exists(fileName))
- return Path.GetFullPath(fileName);
-
- var values = Environment.GetEnvironmentVariable("PATH");
- foreach (var path in values.Split(Path.PathSeparator))
- {
- var fullPath = Path.Combine(path, fileName);
- if (System.IO.File.Exists(fullPath))
- return fullPath;
- }
- return null;
- }
-
- public static bool HasWritePermissions()
- {
- try
- {
- System.IO.File.Create(Path.Combine(GlobalVars.saveDirectory, "writeable.envy")).Close();
- System.IO.File.Delete(Path.Combine(GlobalVars.saveDirectory, "writeable.envy"));
- return true;
- }
- catch (Exception)
- {
- return false;
- }
- }
-
- public static void MoveFilesToAppdata()
- {
- string[] envyFiles = Directory.GetFiles(GlobalVars.directoryOfExe, "*.envy");
- foreach (var item in envyFiles)
- System.IO.File.Move(item, Path.Combine(GlobalVars.appdata, Path.GetFileName(item)));
- if (System.IO.File.Exists(Path.Combine(GlobalVars.directoryOfExe, "envyupdate.log")))
- System.IO.File.Move(Path.Combine(GlobalVars.directoryOfExe, "envyupdate.log"), Path.Combine(GlobalVars.appdata, "envyupdate.log"));
- }
-
- public static void MoveFilesToExe()
- {
- string[] envyFiles = Directory.GetFiles(GlobalVars.appdata, "*.envy");
- foreach (var item in envyFiles)
- System.IO.File.Move(item, Path.Combine(GlobalVars.directoryOfExe, Path.GetFileName(item)));
- if (System.IO.File.Exists(Path.Combine(GlobalVars.appdata, "envyupdate.log")))
- System.IO.File.Move(Path.Combine(GlobalVars.appdata, "envyupdate.log"), Path.Combine(GlobalVars.directoryOfExe, "envyupdate.log"));
+ //TODO Implement downloading
+ //TODO implement progress bar
}
}
-}
+}
\ No newline at end of file
diff --git a/EnvyUpdate/packages.config b/EnvyUpdate/packages.config
new file mode 100644
index 0000000..7c39521
--- /dev/null
+++ b/EnvyUpdate/packages.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index d6dacc4..a8fca58 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2019-2024 fyr77
+Copyright (c) 2019-2022 Jakob Senkl
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index cd44814..d25d870 100644
--- a/README.md
+++ b/README.md
@@ -1,40 +1,35 @@
-# Important Information
-## I am no longer working on this project and I am looking for a new maintainer. Please see [the corresponding issue](https://vcs.diluvian.cc/fyr77/EnvyUpdate/issues/53) for more details.
+
-
+# Important Information
+
+Nvidia seems to have discontinued non-DCH drivers. This means only Windows 10 and Windows 11 can get the most recent driver versions.
+
+If you are running Standard (non-DCH) drivers right now, EnvyUpdate will **NOT** display newer driver versions until you have manually updated to DCH drivers.
# EnvyUpdate
-A small portable update checker application for Nvidia GPUs
+ A small portable update checker application for Nvidia GPUs
+
+ 
+ 
+ 
## How to use
-Download the latest release and run it. Windows SmartScreen Messages can be safely ignored. They only happen because this project is not digitally signed.
+Download the [latest release](https://github.com/fyr77/EnvyUpdate/releases/latest/download/EnvyUpdate.exe) (or as a [.zip](https://github.com/fyr77/EnvyUpdate/releases/latest/download/EnvyUpdate.zip)) and run it. Windows SmartScreen Messages can be safely ignored. They only happen because this project is not digitally signed.
The application itself does not update itself. If you notice any bugs or issues, be sure to check for a new version on GitHub!
-Enabling Autostart will create a shortcut of EnvyUpdate in the Windows startup folder (shell:startup).
-
-### Virus warnings
-
-Sometimes EnvyUpdate is flagged as a virus by Windows Defender or other antivirus software. This is a **false positive**, caused by EnvyUpdate reading a few values from the Windows registry and looking for files.
-
-For extracting the driver installer 7-Zip is downloaded if it cannot be found on the user's system. This may also trigger antivirus warnings, but is necessary for the automatic driver installation to work.
-
-### Using AppData for configuration files
-
-Starting with 3.2, EnvyUpdate supports saving its configuration files to AppData/Roaming instead of saving it next to the main exe file. You can enable it in the settings of the application.
-
-If EnvyUpdate fails to write to the folder containing the exe file, this option will be enabled automatically.
+Enabling Autostart will create a shortcut of EnvyUpdate in the Windows startup folder.
## Compatibility
-The application should be compatible with all Nvidia GeForce GPUs that have their drivers available on the nvidia.com download page and runs on Windows 10 and up.
+The application should be compatible with all Nvidia GeForce GPUs that have their drivers available on the nvidia.com download page and runs on Windows 7 and up.
-It is tested with GeForce Series GPUs. Other series (e.g. Quadro) are unlikely to work and are not supported - if you have a Quadro card and are willing to implement support for them, feel free to reach out or create a PR.
+It is tested with GeForce Series GPUs. Generally others might work, but they are (currently) untested.
## Development
-This application is currently unmaintained and developed by me (fyr77) alone in my free time.
+This application is currently maintained and developed by me (fyr77) alone in my free time.
I always try to implement critical fixes as fast as I can, but other features and minor bug fixes may take a few days or weeks to implement.
@@ -44,18 +39,17 @@ 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-Telemetry](https://github.com/NateShoffner/Disable-Nvidia-Telemetry) - does pretty much what the name says. It disables Nvidia Telemetry.
+* [Disable-Nvidia-Telemtry](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.
## Licenses
-* This project: [MIT](https://https://vcs.diluvian.cc/fyr77/EnvyUpdate/blob/master/LICENSE)
+* This project: [MIT](https://github.com/fyr77/EnvyUpdate/blob/master/LICENSE)
* Fody (dependency of Costura.Fody): [MIT](https://github.com/Fody/Fody/blob/master/License.txt)
* Costura.Fody (for embedding DLLs into the main executable): [MIT](https://github.com/Fody/Costura/blob/develop/LICENSE)
-* Resource Embedder: [MIT](https://www.nuget.org/packages/Resource.Embedder/)
-* Windows Community Toolkit: [MIT](https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/main/License.md)
-* wpfui: [MIT](https://github.com/lepoco/wpfui/blob/main/LICENSE)
-* 7-Zip R: [GNU LGPL](https://www.7-zip.org/license.txt)
+* wpf-notifyicon (for showing an icon in the system tray): [CPOL](https://github.com/hardcodet/wpf-notifyicon/blob/master/LICENSE)
+* Notifications.Wpf: [MIT](https://github.com/Federerer/Notifications.Wpf/blob/master/LICENSE)
+* Resource Embedder: [MIT](https://github.com/MarcStan/resource-embedder/blob/master/LICENSE)
* Icon made by Freepik from www.flaticon.com
diff --git a/res/banner_bg.png b/res/banner_bg.png
deleted file mode 100644
index 350cd67..0000000
Binary files a/res/banner_bg.png and /dev/null differ