diff --git a/EnvyUpdate/Debug.cs b/EnvyUpdate/Debug.cs
new file mode 100644
index 0000000..3b4d7f0
--- /dev/null
+++ b/EnvyUpdate/Debug.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Linq;
+
+namespace EnvyUpdate
+{
+ class Debug
+ {
+ readonly static string debugFilePath = GlobalVars.exepath + "debug.txt";
+ public static int LoadFakeIDs(string idType)
+ {
+ /*
+ * Usage:
+ * Create debug.txt file.
+ * Fill in variables:
+ * Line 1: psid
+ * Line 2: pfid
+ * Line 3: osid
+ * Line 4: dtcid
+ * Line 5: Local driver version
+ *
+ * Supply /debug flag to exe.
+ */
+ string line = null;
+ switch (idType)
+ {
+ case "psid":
+ line = File.ReadLines(debugFilePath).Take(1).First();
+ break;
+ case "pfid":
+ line = File.ReadLines(debugFilePath).Skip(1).Take(1).First();
+ break;
+ case "osid":
+ line = File.ReadLines(debugFilePath).Skip(2).Take(1).First();
+ break;
+ case "dtcid":
+ line = File.ReadLines(debugFilePath).Skip(3).Take(1).First();
+ break;
+ default:
+ break;
+ }
+
+ return int.Parse(line);
+ }
+ public static string LocalDriv()
+ {
+ return File.ReadLines(debugFilePath).Skip(4).Take(1).First();
+ }
+ }
+}
diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj
index edc0a08..4d0512f 100644
--- a/EnvyUpdate/EnvyUpdate.csproj
+++ b/EnvyUpdate/EnvyUpdate.csproj
@@ -95,6 +95,7 @@
MSBuild:Compile
Designer
+
InfoWindow.xaml
diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs
index 402384c..352f9cb 100644
--- a/EnvyUpdate/GlobalVars.cs
+++ b/EnvyUpdate/GlobalVars.cs
@@ -9,7 +9,7 @@ namespace EnvyUpdate
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 float version = 2.3F;
+ public static readonly float version = 2.4F;
public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
public static readonly string desktopOverride = exepath + "desktop.envy";
diff --git a/EnvyUpdate/InfoWindow.xaml b/EnvyUpdate/InfoWindow.xaml
index 9987dc9..66d475f 100644
--- a/EnvyUpdate/InfoWindow.xaml
+++ b/EnvyUpdate/InfoWindow.xaml
@@ -6,19 +6,19 @@
xmlns:local="clr-namespace:EnvyUpdate"
xmlns:p="clr-namespace:EnvyUpdate.Properties"
mc:Ignorable="d"
- Title="" Height="274" Width="286" ResizeMode="NoResize" WindowStyle="ToolWindow" SizeToContent="WidthAndHeight">
+ Title="" Height="290" Width="286" ResizeMode="NoResize" WindowStyle="ToolWindow" SizeToContent="WidthAndHeight">
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/EnvyUpdate/InfoWindow.xaml.cs b/EnvyUpdate/InfoWindow.xaml.cs
index 058b014..8cdd852 100644
--- a/EnvyUpdate/InfoWindow.xaml.cs
+++ b/EnvyUpdate/InfoWindow.xaml.cs
@@ -19,11 +19,12 @@ namespace EnvyUpdate
if (GlobalVars.isMobile)
chkMobile.IsChecked = true;
- if (Util.IsMobile())
- defaultIsMobile = true;
+ defaultIsMobile = Util.IsMobile();
if (defaultIsMobile != GlobalVars.isMobile)
isOverride = true;
+
+ chkDCH.IsChecked = Util.IsDCH();
}
private void ButtonWeb_Click(object sender, RoutedEventArgs e)
diff --git a/EnvyUpdate/MainWindow.xaml b/EnvyUpdate/MainWindow.xaml
index d7300b3..77c6c30 100644
--- a/EnvyUpdate/MainWindow.xaml
+++ b/EnvyUpdate/MainWindow.xaml
@@ -7,7 +7,7 @@
xmlns:p="clr-namespace:EnvyUpdate.Properties"
xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d"
- Title="EnvyUpdate" Height="159" Width="290.5" Icon="icon.ico" StateChanged="Window_StateChanged" Closing="Window_Closing" ResizeMode="CanMinimize">
+ Title="EnvyUpdate" Height="160" Width="290" Icon="icon.ico" StateChanged="Window_StateChanged" Closing="Window_Closing" ResizeMode="CanMinimize">
diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs
index fc7fb9c..a05d3db 100644
--- a/EnvyUpdate/MainWindow.xaml.cs
+++ b/EnvyUpdate/MainWindow.xaml.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
@@ -85,16 +86,15 @@ namespace EnvyUpdate
}
else
{
- switch (argument)
+ if (argument == "/debug")
{
- case "/ignoregpu":
- MessageBox.Show("Debug: GPU ignored.");
- isDebug = true;
- break;
- default:
- MessageBox.Show(Properties.Resources.no_compatible_gpu);
- Environment.Exit(255);
- break;
+ MessageBox.Show("Debug mode!");
+ isDebug = true;
+ }
+ else
+ {
+ MessageBox.Show(Properties.Resources.no_compatible_gpu);
+ Environment.Exit(255);
}
}
@@ -119,38 +119,50 @@ namespace EnvyUpdate
private void Load()
{
- int psid;
- int pfid;
- int osid;
+ int psid = 0;
+ int pfid = 0;
+ int osid = 0;
+ int dtcid = 0;
//int langid;
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
if (!isDebug)
{
- psid = Util.GetIDs("pfid");
- pfid = Util.GetIDs("psid");
+ psid = Util.GetIDs("psid");
+ pfid = Util.GetIDs("pfid");
osid = Util.GetIDs("osid");
- gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString(); // + "&lid=" + langid.ToString();
- WebClient c = new WebClient();
- gpuURL = c.DownloadString(gpuURL);
- string pContent = c.DownloadString(gpuURL);
- var pattern = @"\d{3}\.\d{2} ";
- Regex rgx = new Regex(pattern);
- var matches = rgx.Matches(pContent);
- onlineDriv = Convert.ToString(matches[0]);
- onlineDriv = onlineDriv.Remove(onlineDriv.Length - 5);
- textblockOnline.Text = onlineDriv;
- c.Dispose();
-
- if (float.Parse(localDriv) < float.Parse(onlineDriv))
- {
- textblockOnline.Foreground = Brushes.Red;
- buttonDL.Visibility = Visibility.Visible;
- Notify.ShowDrivUpdatePopup();
- }
- else
- textblockOnline.Foreground = Brushes.Green;
+ dtcid = Util.GetDTCID();
}
+ else
+ {
+ psid = Debug.LoadFakeIDs("psid");
+ pfid = Debug.LoadFakeIDs("pfid");
+ osid = Debug.LoadFakeIDs("osid");
+ dtcid = Debug.LoadFakeIDs("dtcid");
+ localDriv = Debug.LocalDriv();
+ textblockGPU.Text = localDriv;
+ }
+
+ gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString() + "&dtcid=" + dtcid.ToString(); // + "&lid=" + langid.ToString();
+ WebClient c = new WebClient();
+ gpuURL = c.DownloadString(gpuURL);
+ string pContent = c.DownloadString(gpuURL);
+ var pattern = @"\d{3}\.\d{2} ";
+ Regex rgx = new Regex(pattern);
+ var matches = rgx.Matches(pContent);
+ onlineDriv = Convert.ToString(matches[0]);
+ onlineDriv = onlineDriv.Remove(onlineDriv.Length - 5);
+ textblockOnline.Text = onlineDriv;
+ c.Dispose();
+
+ if (float.Parse(localDriv) < float.Parse(onlineDriv))
+ {
+ textblockOnline.Foreground = Brushes.Red;
+ buttonDL.Visibility = Visibility.Visible;
+ Notify.ShowDrivUpdatePopup();
+ }
+ else
+ textblockOnline.Foreground = Brushes.Green;
if (GlobalVars.exepath == GlobalVars.appdata)
{
@@ -161,7 +173,7 @@ namespace EnvyUpdate
private void buttonDL_Click(object sender, RoutedEventArgs e)
{
- System.Diagnostics.Process.Start(gpuURL);
+ Process.Start(gpuURL);
}
private void TaskbarIcon_TrayLeftMouseDown(object sender, RoutedEventArgs e)
diff --git a/EnvyUpdate/Properties/AssemblyInfo.cs b/EnvyUpdate/Properties/AssemblyInfo.cs
index ce694c2..0791eb4 100644
--- a/EnvyUpdate/Properties/AssemblyInfo.cs
+++ b/EnvyUpdate/Properties/AssemblyInfo.cs
@@ -51,5 +51,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("2.3")]
-[assembly: AssemblyFileVersion("2.3")]
+[assembly: AssemblyVersion("2.4")]
+[assembly: AssemblyFileVersion("2.4")]
diff --git a/EnvyUpdate/Properties/Resources.Designer.cs b/EnvyUpdate/Properties/Resources.Designer.cs
index 33ad0e8..2ff9628 100644
--- a/EnvyUpdate/Properties/Resources.Designer.cs
+++ b/EnvyUpdate/Properties/Resources.Designer.cs
@@ -132,6 +132,15 @@ namespace EnvyUpdate.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to DCH driver.
+ ///
+ public static string ui_info_dch {
+ get {
+ return ResourceManager.GetString("ui_info_dch", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Mobile GPU (Laptop, etc)?.
///
diff --git a/EnvyUpdate/Properties/Resources.de.resx b/EnvyUpdate/Properties/Resources.de.resx
index 36a36bf..6891348 100644
--- a/EnvyUpdate/Properties/Resources.de.resx
+++ b/EnvyUpdate/Properties/Resources.de.resx
@@ -141,6 +141,9 @@
Autostart
+
+ DCH Treiber
+
Mobile Grafikkarte (Laptop, etc)?
diff --git a/EnvyUpdate/Properties/Resources.resx b/EnvyUpdate/Properties/Resources.resx
index 67f12e1..922b34a 100644
--- a/EnvyUpdate/Properties/Resources.resx
+++ b/EnvyUpdate/Properties/Resources.resx
@@ -141,6 +141,9 @@
Autostart
+
+ DCH driver
+
Mobile GPU (Laptop, etc)?
diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs
index 2d0cdfc..56f9158 100644
--- a/EnvyUpdate/Util.cs
+++ b/EnvyUpdate/Util.cs
@@ -357,6 +357,10 @@ namespace EnvyUpdate
// This should NEVER return null outside of debugging mode, since EnvyUpdate should refuse to start without and Nvidia GPU.
return GPUName;
}
+ ///
+ /// Checks for Battery and assumes a mobile GPU if present.
+ ///
+ ///
public static bool IsMobile()
{
bool result = false;
@@ -372,10 +376,31 @@ namespace EnvyUpdate
return result;
}
+ ///
+ /// Checks Windows registry for Nvidia DCH Key. If it is present, returns true.
+ ///
+ ///
public static bool IsDCH()
{
- RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true);
- return nvlddmkm.GetValueNames().Contains("DCHUVen");
+ try
+ {
+ RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true);
+ return nvlddmkm.GetValueNames().Contains("DCHUVen");
+ }
+ catch (NullReferenceException)
+ {
+ // Assume no DCH driver is installed if key is not found.
+ return false;
+ }
+ }
+ public static int GetDTCID()
+ {
+ int dtcid = 0;
+ if (IsDCH())
+ {
+ dtcid = 1;
+ }
+ return dtcid;
}
}
}
\ No newline at end of file