add DCH compat, better debug
This commit is contained in:
parent
58631d5d8a
commit
a42641fdce
12 changed files with 157 additions and 54 deletions
49
EnvyUpdate/Debug.cs
Normal file
49
EnvyUpdate/Debug.cs
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -95,6 +95,7 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="Debug.cs" />
|
||||||
<Compile Include="GlobalVars.cs" />
|
<Compile Include="GlobalVars.cs" />
|
||||||
<Compile Include="InfoWindow.xaml.cs">
|
<Compile Include="InfoWindow.xaml.cs">
|
||||||
<DependentUpon>InfoWindow.xaml</DependentUpon>
|
<DependentUpon>InfoWindow.xaml</DependentUpon>
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace EnvyUpdate
|
||||||
public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location;
|
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 exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
|
||||||
public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
|
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 appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
|
||||||
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
||||||
public static readonly string desktopOverride = exepath + "desktop.envy";
|
public static readonly string desktopOverride = exepath + "desktop.envy";
|
||||||
|
|
|
@ -6,19 +6,19 @@
|
||||||
xmlns:local="clr-namespace:EnvyUpdate"
|
xmlns:local="clr-namespace:EnvyUpdate"
|
||||||
xmlns:p="clr-namespace:EnvyUpdate.Properties"
|
xmlns:p="clr-namespace:EnvyUpdate.Properties"
|
||||||
mc:Ignorable="d"
|
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">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button Content="{x:Static p:Resources.ui_info_website}" Margin="10,10,10,0" VerticalAlignment="Top" Height="20" Click="ButtonWeb_Click"/>
|
<Button Content="{x:Static p:Resources.ui_info_website}" Margin="10,10,10,0" VerticalAlignment="Top" Height="20" Click="ButtonWeb_Click"/>
|
||||||
<Label Content="Licenses:" HorizontalAlignment="Left" Margin="10,60,0,0" VerticalAlignment="Top" FontWeight="Bold"/>
|
<Label Content="Licenses:" HorizontalAlignment="Left" Margin="10,73,0,0" VerticalAlignment="Top" FontWeight="Bold"/>
|
||||||
<TextBlock x:Name="textEnvyUpdate" Margin="10,91,10,0" TextWrapping="Wrap" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textEnvyUpdate_MouseDown"><Run Text="EnvyUpdate"/><Run Text=": MIT"/></TextBlock>
|
<TextBlock x:Name="textEnvyUpdate" Margin="10,104,10,0" TextWrapping="Wrap" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textEnvyUpdate_MouseDown"><Run Text="EnvyUpdate"/><Run Text=": MIT"/></TextBlock>
|
||||||
<TextBlock x:Name="textFody" Margin="10,109,10,0" TextWrapping="Wrap" Text="Fody: MIT" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textFody_MouseDown"/>
|
<TextBlock x:Name="textFody" Margin="10,122,10,0" TextWrapping="Wrap" Text="Fody: MIT" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textFody_MouseDown"/>
|
||||||
<TextBlock x:Name="textNotifyIcon" Margin="10,145,10,0" TextWrapping="Wrap" Text="wpf-notifyicon: CPOL" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textNotifyIcon_MouseDown"/>
|
<TextBlock x:Name="textNotifyIcon" Margin="10,158,10,0" TextWrapping="Wrap" Text="wpf-notifyicon: CPOL" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textNotifyIcon_MouseDown"/>
|
||||||
<TextBlock x:Name="textNotifications" Margin="10,163,10,0" TextWrapping="Wrap" Text="Notifications.Wpf: MIT" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textNotifications_MouseDown"/>
|
<TextBlock x:Name="textNotifications" Margin="10,176,10,0" TextWrapping="Wrap" Text="Notifications.Wpf: MIT" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textNotifications_MouseDown"/>
|
||||||
<TextBlock Margin="10,217,10,0" TextWrapping="Wrap" Text="Icon made by Freepik from www.flaticon.com" Height="18" VerticalAlignment="Top"/>
|
<TextBlock Margin="10,230,10,0" TextWrapping="Wrap" Text="Icon made by Freepik from www.flaticon.com" Height="18" VerticalAlignment="Top"/>
|
||||||
<TextBlock x:Name="textNewtonsoft" Margin="10,181,10,0" TextWrapping="Wrap" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textNewtonsoft_MouseDown"><Run Text="Newtonsoft.Json"/><Run Text=": MIT"/></TextBlock>
|
<TextBlock x:Name="textNewtonsoft" Margin="10,194,10,0" TextWrapping="Wrap" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textNewtonsoft_MouseDown"><Run Text="Newtonsoft.Json"/><Run Text=": MIT"/></TextBlock>
|
||||||
<TextBlock x:Name="textCostura" Margin="10,127,10,0" TextWrapping="Wrap" Text="Costura.Fody: MIT" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textCostura_MouseDown"/>
|
<TextBlock x:Name="textCostura" Margin="10,140,10,0" TextWrapping="Wrap" Text="Costura.Fody: MIT" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textCostura_MouseDown"/>
|
||||||
<CheckBox x:Name="chkMobile" Content="{x:Static p:Resources.ui_info_mobile}" Margin="10,40,10,0" VerticalAlignment="Top" Checked="chkMobile_Checked" Unchecked="chkMobile_Unchecked"/>
|
<CheckBox x:Name="chkMobile" Content="{x:Static p:Resources.ui_info_mobile}" Margin="10,40,10,0" VerticalAlignment="Top" Checked="chkMobile_Checked" Unchecked="chkMobile_Unchecked"/>
|
||||||
<TextBlock x:Name="textResourceEmbedder" Margin="10,199,10,0" TextWrapping="Wrap" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textResourceEmbedder_MouseDown"><Run Text="Resource Embedder"/><Run Text=": MIT"/></TextBlock>
|
<TextBlock x:Name="textResourceEmbedder" Margin="10,212,10,0" TextWrapping="Wrap" Height="18" VerticalAlignment="Top" MouseEnter="text_MouseEnter" MouseLeave="text_MouseLeave" MouseDown="textResourceEmbedder_MouseDown"><Run Text="Resource Embedder"/><Run Text=": MIT"/></TextBlock>
|
||||||
|
<CheckBox x:Name="chkDCH" Content="{x:Static p:Resources.ui_info_dch}" Margin="10,60,10,0" VerticalAlignment="Top" IsEnabled="False"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
@ -19,11 +19,12 @@ namespace EnvyUpdate
|
||||||
if (GlobalVars.isMobile)
|
if (GlobalVars.isMobile)
|
||||||
chkMobile.IsChecked = true;
|
chkMobile.IsChecked = true;
|
||||||
|
|
||||||
if (Util.IsMobile())
|
defaultIsMobile = Util.IsMobile();
|
||||||
defaultIsMobile = true;
|
|
||||||
|
|
||||||
if (defaultIsMobile != GlobalVars.isMobile)
|
if (defaultIsMobile != GlobalVars.isMobile)
|
||||||
isOverride = true;
|
isOverride = true;
|
||||||
|
|
||||||
|
chkDCH.IsChecked = Util.IsDCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonWeb_Click(object sender, RoutedEventArgs e)
|
private void ButtonWeb_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
xmlns:p="clr-namespace:EnvyUpdate.Properties"
|
xmlns:p="clr-namespace:EnvyUpdate.Properties"
|
||||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||||
mc:Ignorable="d"
|
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">
|
||||||
<Grid Margin="0,0,0,0">
|
<Grid Margin="0,0,0,0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="17*"/>
|
<RowDefinition Height="17*"/>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
@ -85,16 +86,15 @@ namespace EnvyUpdate
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (argument)
|
if (argument == "/debug")
|
||||||
{
|
{
|
||||||
case "/ignoregpu":
|
MessageBox.Show("Debug mode!");
|
||||||
MessageBox.Show("Debug: GPU ignored.");
|
isDebug = true;
|
||||||
isDebug = true;
|
}
|
||||||
break;
|
else
|
||||||
default:
|
{
|
||||||
MessageBox.Show(Properties.Resources.no_compatible_gpu);
|
MessageBox.Show(Properties.Resources.no_compatible_gpu);
|
||||||
Environment.Exit(255);
|
Environment.Exit(255);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,38 +119,50 @@ namespace EnvyUpdate
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
{
|
{
|
||||||
int psid;
|
int psid = 0;
|
||||||
int pfid;
|
int pfid = 0;
|
||||||
int osid;
|
int osid = 0;
|
||||||
|
int dtcid = 0;
|
||||||
//int langid;
|
//int langid;
|
||||||
|
|
||||||
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
|
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
|
||||||
if (!isDebug)
|
if (!isDebug)
|
||||||
{
|
{
|
||||||
psid = Util.GetIDs("pfid");
|
psid = Util.GetIDs("psid");
|
||||||
pfid = Util.GetIDs("psid");
|
pfid = Util.GetIDs("pfid");
|
||||||
osid = Util.GetIDs("osid");
|
osid = Util.GetIDs("osid");
|
||||||
gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString(); // + "&lid=" + langid.ToString();
|
dtcid = Util.GetDTCID();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
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)
|
if (GlobalVars.exepath == GlobalVars.appdata)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +173,7 @@ namespace EnvyUpdate
|
||||||
|
|
||||||
private void buttonDL_Click(object sender, RoutedEventArgs e)
|
private void buttonDL_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(gpuURL);
|
Process.Start(gpuURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TaskbarIcon_TrayLeftMouseDown(object sender, RoutedEventArgs e)
|
private void TaskbarIcon_TrayLeftMouseDown(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -51,5 +51,5 @@ using System.Windows;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.3")]
|
[assembly: AssemblyVersion("2.4")]
|
||||||
[assembly: AssemblyFileVersion("2.3")]
|
[assembly: AssemblyFileVersion("2.4")]
|
||||||
|
|
9
EnvyUpdate/Properties/Resources.Designer.cs
generated
9
EnvyUpdate/Properties/Resources.Designer.cs
generated
|
@ -132,6 +132,15 @@ namespace EnvyUpdate.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to DCH driver.
|
||||||
|
/// </summary>
|
||||||
|
public static string ui_info_dch {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ui_info_dch", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Mobile GPU (Laptop, etc)?.
|
/// Looks up a localized string similar to Mobile GPU (Laptop, etc)?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -141,6 +141,9 @@
|
||||||
<data name="ui_autostart" xml:space="preserve">
|
<data name="ui_autostart" xml:space="preserve">
|
||||||
<value>Autostart</value>
|
<value>Autostart</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ui_info_dch" xml:space="preserve">
|
||||||
|
<value>DCH Treiber</value>
|
||||||
|
</data>
|
||||||
<data name="ui_info_mobile" xml:space="preserve">
|
<data name="ui_info_mobile" xml:space="preserve">
|
||||||
<value>Mobile Grafikkarte (Laptop, etc)?</value>
|
<value>Mobile Grafikkarte (Laptop, etc)?</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -141,6 +141,9 @@
|
||||||
<data name="ui_autostart" xml:space="preserve">
|
<data name="ui_autostart" xml:space="preserve">
|
||||||
<value>Autostart</value>
|
<value>Autostart</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ui_info_dch" xml:space="preserve">
|
||||||
|
<value>DCH driver</value>
|
||||||
|
</data>
|
||||||
<data name="ui_info_mobile" xml:space="preserve">
|
<data name="ui_info_mobile" xml:space="preserve">
|
||||||
<value>Mobile GPU (Laptop, etc)?</value>
|
<value>Mobile GPU (Laptop, etc)?</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -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.
|
// This should NEVER return null outside of debugging mode, since EnvyUpdate should refuse to start without and Nvidia GPU.
|
||||||
return GPUName;
|
return GPUName;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Checks for Battery and assumes a mobile GPU if present.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static bool IsMobile()
|
public static bool IsMobile()
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -372,10 +376,31 @@ namespace EnvyUpdate
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Checks Windows registry for Nvidia DCH Key. If it is present, returns true.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static bool IsDCH()
|
public static bool IsDCH()
|
||||||
{
|
{
|
||||||
RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true);
|
try
|
||||||
return nvlddmkm.GetValueNames().Contains("DCHUVen");
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in a new issue