From 76ead731633d43529b7d027fa8e449a5af39e28f Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 30 Dec 2019 21:06:47 +0100 Subject: [PATCH 001/185] fix updater i feel dumb --- EnvyUpdate/EnvyUpdate.csproj | 1 + EnvyUpdate/StringExt.cs | 17 +++++++++++++++++ EnvyUpdate/Util.cs | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 EnvyUpdate/StringExt.cs diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index edcf909..c773f85 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -75,6 +75,7 @@ Designer + MSBuild:Compile diff --git a/EnvyUpdate/StringExt.cs b/EnvyUpdate/StringExt.cs new file mode 100644 index 0000000..7f421b5 --- /dev/null +++ b/EnvyUpdate/StringExt.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EnvyUpdate +{ + public static class StringExt + { + public static string Truncate(this string value, int maxLength) + { + if (string.IsNullOrEmpty(value)) return value; + return value.Length <= maxLength ? value : value.Substring(0, maxLength); + } + } +} diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index f4a1ba1..9a10b15 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -111,7 +111,7 @@ namespace EnvyUpdate string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt"; System.Net.WebClient wc = new System.Net.WebClient(); - string webData = wc.DownloadString(updPath); + string webData = wc.DownloadString(updPath).Truncate(3); return webData; } From bfa35c89fe127e218744536dd0aa73374ff8a61e Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 30 Dec 2019 21:10:19 +0100 Subject: [PATCH 002/185] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index f385068..29d33c7 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ Simply download the latest release from the [releases page](https://github.com/f The application is compatible with all Nvidia GPUs that have their drivers available on the nvidia.com download page and runs on Windows 7 and up. +## Planned features + +* Translation support + ## Licenses * This project: [MIT](https://github.com/fyr77/EnvyUpdate/blob/master/LICENSE) From 527e1b691dbda5d03f1a11bec9921b096aead6b3 Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 30 Dec 2019 21:14:47 +0100 Subject: [PATCH 003/185] bump version --- EnvyUpdate/MainWindow.xaml.cs | 2 +- res/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index c8a2626..138a4b3 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -21,7 +21,7 @@ namespace EnvyUpdate readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); - readonly string version = "1.0"; + readonly string version = "1.1"; public MainWindow() { diff --git a/res/version.txt b/res/version.txt index d3827e7..9459d4b 100644 --- a/res/version.txt +++ b/res/version.txt @@ -1 +1 @@ -1.0 +1.1 From 1f29a05e8017b762bfd1104b5508a6b04f2fd3f8 Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 30 Dec 2019 21:19:42 +0100 Subject: [PATCH 004/185] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 29d33c7..0e67e77 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## How to use - 1. Download the latest release from the [releases page](https://github.com/fyr77/EnvyUpdate/releases) and run it. Windows SmartScreen Messages can be safely ignored. They only happen because this project is not digitally signed. + 1. 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. 2. If you want to use the application without saving any settings to your drive, keep the "Portable mode" checkbox checked. Otherwise uncheck it to automatically save your configuration. 3. Install the cookie-txt addon for [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt-one-click/) or [Chrome](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg). 4. Go to the [Nvidia driver download page](https://www.nvidia.com/Download/index.aspx), enter your graphics card model, operating system, etc. and click "Search". @@ -29,4 +29,4 @@ The application is compatible with all Nvidia GPUs that have their drivers avail * This project: [MIT](https://github.com/fyr77/EnvyUpdate/blob/master/LICENSE) * Fody (for embedding DLLs into the main executable): [MIT](https://github.com/Fody/Fody/blob/master/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) +* Notifications.Wpf: [MIT](https://github.com/Federerer/Notifications.Wpf/blob/master/LICENSE) From b7ae273fa34d588ed0977e8f93d6a45b8bb07187 Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 30 Dec 2019 21:21:22 +0100 Subject: [PATCH 005/185] optimise startup a bit --- EnvyUpdate/MainWindow.xaml.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index 138a4b3..de69848 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -37,16 +37,19 @@ namespace EnvyUpdate Directory.CreateDirectory(appdata); } - try + if (exepath == appdata) { - if (Util.GetNewVer() != version && exepath == appdata) + try { - Util.UpdateApp(); + if (Util.GetNewVer() != version) + { + Util.UpdateApp(); + } + } + catch (WebException) + { + //Silently fail. } - } - catch (WebException) - { - //Silently fail. } if (Util.GetLocDriv() != null) From 2b523fa7d449b1ba9595aeeb656ccd5027a5e4ef Mon Sep 17 00:00:00 2001 From: fyr77 Date: Fri, 29 May 2020 11:21:03 +0200 Subject: [PATCH 006/185] cleanup code and update packages --- EnvyUpdate/EnvyUpdate.csproj | 4 ++-- EnvyUpdate/MainWindow.xaml.cs | 28 +++++++++++++++++----------- EnvyUpdate/Notify.cs | 4 ++-- EnvyUpdate/StringExt.cs | 10 ++-------- EnvyUpdate/Util.cs | 22 ++++++++++++++-------- EnvyUpdate/packages.config | 2 +- 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index c773f85..d6075f6 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -140,7 +140,7 @@ 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/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index de69848..bdccd02 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -1,8 +1,8 @@ using System; -using System.Windows; using System.IO; using System.Net; using System.Text.RegularExpressions; +using System.Windows; using System.Windows.Media; using System.Windows.Threading; @@ -13,20 +13,22 @@ namespace EnvyUpdate /// public partial class MainWindow : Window { - string localDriv = null; - string onlineDriv = null; - readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\"; - readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); - string gpuURL = null; - readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; - readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; - readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); - readonly string version = "1.1"; + private string localDriv = null; + private string onlineDriv = null; + private readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\"; + private readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); + private string gpuURL = null; + private readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; + private readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; + private readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); + private readonly string version = "1.1"; public MainWindow() { InitializeComponent(); Title += " " + version; + + // Check if EnvyUpdate is already running if (Util.IsInstanceOpen("EnvyUpdate")) { MessageBox.Show("Application is already running."); @@ -37,6 +39,7 @@ namespace EnvyUpdate Directory.CreateDirectory(appdata); } + // Check if application is in Autorun mode and update if (exepath == appdata) { try @@ -102,6 +105,7 @@ namespace EnvyUpdate } } } + private void Load() { FileInfo f = new FileInfo(appdata + "nvidia-update.txt"); @@ -143,6 +147,7 @@ namespace EnvyUpdate Hide(); } } + private void Load(string[] files) { FileInfo f = new FileInfo(files[0]); @@ -184,6 +189,7 @@ namespace EnvyUpdate else textblockOnline.Foreground = Brushes.Green; } + private void buttonDL_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Process.Start(gpuURL); @@ -247,4 +253,4 @@ namespace EnvyUpdate Application.Current.Shutdown(); } } -} +} \ No newline at end of file diff --git a/EnvyUpdate/Notify.cs b/EnvyUpdate/Notify.cs index 4754310..a7c944c 100644 --- a/EnvyUpdate/Notify.cs +++ b/EnvyUpdate/Notify.cs @@ -2,7 +2,7 @@ namespace EnvyUpdate { - class Notify + internal class Notify { public static void ShowDrivUpdatePopup() { @@ -16,4 +16,4 @@ namespace EnvyUpdate }, onClick: Util.ShowMain); } } -} +} \ No newline at end of file diff --git a/EnvyUpdate/StringExt.cs b/EnvyUpdate/StringExt.cs index 7f421b5..fbcd4e0 100644 --- a/EnvyUpdate/StringExt.cs +++ b/EnvyUpdate/StringExt.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace EnvyUpdate +namespace EnvyUpdate { public static class StringExt { @@ -14,4 +8,4 @@ namespace EnvyUpdate return value.Length <= maxLength ? value : value.Substring(0, maxLength); } } -} +} \ No newline at end of file diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index 9a10b15..2edd933 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -1,15 +1,15 @@ -using System; +using IWshRuntimeLibrary; +using System; +using System.Diagnostics; +using System.IO; using System.Linq; using System.Management; -using System.IO; -using IWshRuntimeLibrary; -using System.Diagnostics; -using System.Windows; using System.Net; +using System.Windows; namespace EnvyUpdate { - class Util + internal class Util { /// /// Parses GPU info from a cookie file @@ -35,6 +35,7 @@ namespace EnvyUpdate int lastno = Convert.ToInt32(found.Split().Last()); return lastno; } + /// /// Gets local driver version. /// @@ -68,6 +69,7 @@ namespace EnvyUpdate return null; } } + /// /// Creates a standard Windows shortcut. /// @@ -85,6 +87,7 @@ namespace EnvyUpdate shortcut.TargetPath = targetFileLocation; shortcut.Save(); } + public static bool IsInstanceOpen(string name) { int count = 0; @@ -101,20 +104,23 @@ namespace EnvyUpdate else return false; } + public static void ShowMain() { Application.Current.MainWindow.Show(); Application.Current.MainWindow.WindowState = WindowState.Normal; } + public static string GetNewVer() { string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt"; - System.Net.WebClient wc = new System.Net.WebClient(); + WebClient wc = new WebClient(); string webData = wc.DownloadString(updPath).Truncate(3); return webData; } + /// /// Updates the application by downloading the new version from Github and replacing the old file using a seperate CMD instance. /// @@ -144,4 +150,4 @@ namespace EnvyUpdate Environment.Exit(2); } } -} +} \ No newline at end of file diff --git a/EnvyUpdate/packages.config b/EnvyUpdate/packages.config index 1c2b0dd..9ed1b0a 100644 --- a/EnvyUpdate/packages.config +++ b/EnvyUpdate/packages.config @@ -1,7 +1,7 @@  - + \ No newline at end of file From 9cc8e8869823bd50afee6b6f6cdb014a85072fc8 Mon Sep 17 00:00:00 2001 From: Jakob Date: Tue, 14 Jul 2020 14:32:47 +0200 Subject: [PATCH 007/185] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0e67e77..2047392 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # EnvyUpdate A small update checker application for Nvidia GPUs + ![License](https://img.shields.io/github/license/fyr77/envyupdate?style=for-the-badge) + ![Issues](https://img.shields.io/github/issues/fyr77/envyupdate?style=for-the-badge) + ![Version](https://img.shields.io/github/v/release/fyr77/envyupdate?style=for-the-badge) + ## How to use 1. 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. From 5c7831b855338b2db96035154ef98555f05bbbd9 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Tue, 14 Jul 2020 15:31:32 +0200 Subject: [PATCH 008/185] add debug feature, update icon, add licenses, bump version --- EnvyUpdate/EnvyUpdate.csproj | 7 +++++ EnvyUpdate/InfoWindow.xaml | 19 +++++++++++++ EnvyUpdate/InfoWindow.xaml.cs | 51 ++++++++++++++++++++++++++++++++++ EnvyUpdate/MainWindow.xaml.cs | 26 ++++++++++++----- EnvyUpdate/icon.ico | Bin 101917 -> 106671 bytes EnvyUpdate/icon.png | Bin 6516 -> 14489 bytes README.md | 1 + res/version.txt | 2 +- 8 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 EnvyUpdate/InfoWindow.xaml create mode 100644 EnvyUpdate/InfoWindow.xaml.cs diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index d6075f6..28d1867 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -74,9 +74,16 @@ MSBuild:Compile Designer + + InfoWindow.xaml + + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/EnvyUpdate/InfoWindow.xaml b/EnvyUpdate/InfoWindow.xaml new file mode 100644 index 0000000..86ce504 --- /dev/null +++ b/EnvyUpdate/InfoWindow.xaml @@ -0,0 +1,19 @@ + + + public partial class InfoWindow : Window { + bool defaultIsMobile = false; + bool isOverride = false; public InfoWindow() { InitializeComponent(); + + if (GlobalVars.isMobile) + chkMobile.IsChecked = true; + + if (Util.IsMobile()) + defaultIsMobile = true; + + if (defaultIsMobile != GlobalVars.isMobile) + isOverride = true; } - private void Button_Click(object sender, RoutedEventArgs e) + private void ButtonWeb_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Process.Start("https://github.com/fyr77/EnvyUpdate/"); } @@ -56,5 +69,62 @@ namespace EnvyUpdate { System.Diagnostics.Process.Start("https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md"); } + + private void chkMobile_Checked(object sender, RoutedEventArgs e) + { + if (isOverride) + { + // If an override was present, delete it. + bool deleteSuccess = false; + while (!deleteSuccess) + { + try + { + File.Delete(GlobalVars.desktopOverride); + deleteSuccess = true; + } + catch (IOException) + { + // This is necessary in case someone ticks and unticks the option quickly, as the File.Create Method has sometimes yet to close the file. + } + } + isOverride = false; + } + else + { + File.Create(GlobalVars.mobileOverride).Close(); + GlobalVars.isMobile = true; + isOverride = true; + } + } + + private void chkMobile_Unchecked(object sender, RoutedEventArgs e) + { + if (isOverride) + { + // If an override was present, delete it. + bool deleteSuccess = false; + while (!deleteSuccess) + { + try + { + File.Delete(GlobalVars.mobileOverride); + deleteSuccess = true; + } + catch (IOException) + { + // This is necessary in case someone ticks and unticks the option quickly, as the File.Create Method has sometimes yet to close the file. + } + } + + isOverride = false; + } + else + { + File.Create(GlobalVars.desktopOverride).Close(); + GlobalVars.isMobile = false; + isOverride = true; + } + } } } diff --git a/EnvyUpdate/MainWindow.xaml b/EnvyUpdate/MainWindow.xaml index 078c8d0..d7300b3 100644 --- a/EnvyUpdate/MainWindow.xaml +++ b/EnvyUpdate/MainWindow.xaml @@ -4,18 +4,24 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:EnvyUpdate" + xmlns:p="clr-namespace:EnvyUpdate.Properties" xmlns:tb="http://www.hardcodet.net/taskbar" mc:Ignorable="d" - Title="EnvyUpdate" Height="140" Width="463" Icon="icon.ico" ResizeMode="CanMinimize" StateChanged="Window_StateChanged" Closing="Window_Closing"> - - - - -