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..6878393 100644 --- a/EnvyUpdate.sln +++ b/EnvyUpdate.sln @@ -1,41 +1,20 @@  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..56efbc7 100644 --- a/EnvyUpdate/App.config +++ b/EnvyUpdate/App.config @@ -1,34 +1,6 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ 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..3e57067 100644 --- a/EnvyUpdate/App.xaml.cs +++ b/EnvyUpdate/App.xaml.cs @@ -1,14 +1,10 @@ -using Microsoft.Toolkit.Uwp.Notifications; -using System; +using System; using System.Collections.Generic; using System.Configuration; using System.Data; -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 +13,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 deleted file mode 100644 index 35e6e04..0000000 --- a/EnvyUpdate/Debug.cs +++ /dev/null @@ -1,60 +0,0 @@ -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. - */ - switch (idType) - { - case "psid": - return 127; - case "pfid": - return 999; - case "osid": - return 57; - case "dtcid": - return 1; - case "dtid": - return 1; - default: - return -1; - } - } - public static string LocalDriv() - { - return "466.11"; - } - - 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"); - } - } - } -} diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index cc7331b..4a0ab73 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -1,5 +1,6 @@  + Debug @@ -8,7 +9,7 @@ WinExe EnvyUpdate EnvyUpdate - v4.8 + v4.7.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -16,22 +17,6 @@ true - false - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true AnyCPU @@ -58,90 +43,16 @@ false - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - 7.3 - prompt - MinimumRecommendedRules.ruleset - true - - - 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.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll + - - @@ -160,26 +71,6 @@ MSBuild:Compile Designer - - - - - DashboardPage.xaml - - - True - True - Licenses.resx - - - Resources.de.resx - True - True - - - SettingsPage.xaml - - MSBuild:Compile @@ -193,14 +84,6 @@ MainWindow.xaml Code - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - @@ -216,19 +99,11 @@ Settings.settings True - - ResXFileCodeGenerator - Licenses.Designer.cs - - - PublicResXFileCodeGenerator - Resources.de.Designer.cs - - PublicResXFileCodeGenerator + ResXFileCodeGenerator Resources.Designer.cs - + SettingsSingleFileGenerator Settings.Designer.cs @@ -254,39 +129,13 @@ True - - - False - Microsoft .NET Framework 4.7.2 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - 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 deleted file mode 100644 index f52b4af..0000000 --- a/EnvyUpdate/GlobalVars.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.IO; - -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 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 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/MainWindow.xaml b/EnvyUpdate/MainWindow.xaml index 5015f14..4137ab0 100644 --- a/EnvyUpdate/MainWindow.xaml +++ b/EnvyUpdate/MainWindow.xaml @@ -1,64 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +