diff --git a/EnvyUpdate/Debug.cs b/EnvyUpdate/Debug.cs
index a239764..43e54b9 100644
--- a/EnvyUpdate/Debug.cs
+++ b/EnvyUpdate/Debug.cs
@@ -49,7 +49,6 @@ namespace EnvyUpdate
return "Nvidia GeForce RTX 4080 (debug)";
}
- [ConditionalAttribute("DEBUG")]
public static void LogToFile(string content)
{
if (isVerbose)
diff --git a/EnvyUpdate/InfoWindow.xaml b/EnvyUpdate/InfoWindow.xaml
index bdc6ca6..e9d09c5 100644
--- a/EnvyUpdate/InfoWindow.xaml
+++ b/EnvyUpdate/InfoWindow.xaml
@@ -7,14 +7,20 @@
xmlns:p="clr-namespace:EnvyUpdate.Properties"
mc:Ignorable="d"
Title="" Height="400" Width="600" ResizeMode="NoResize" WindowStyle="ToolWindow" SizeToContent="WidthAndHeight">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EnvyUpdate/InfoWindow.xaml.cs b/EnvyUpdate/InfoWindow.xaml.cs
index 9bba5d5..e610e89 100644
--- a/EnvyUpdate/InfoWindow.xaml.cs
+++ b/EnvyUpdate/InfoWindow.xaml.cs
@@ -21,6 +21,9 @@ namespace EnvyUpdate
labelVer.Content += " " + version;
if (GlobalVars.monitoringInstall)
labelVer.FontStyle = FontStyles.Italic;
+
+ if (File.Exists(Path.Combine(GlobalVars.exeloc, "envyupdate.log")))
+ chkLog.IsChecked = true;
}
private void ButtonWeb_Click(object sender, RoutedEventArgs e)
@@ -28,5 +31,20 @@ namespace EnvyUpdate
Debug.LogToFile("INFO Launching website.");
System.Diagnostics.Process.Start("https://github.com/fyr77/EnvyUpdate/");
}
+
+ private void chkLog_Checked(object sender, RoutedEventArgs e)
+ {
+ 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)
+ {
+ Debug.LogToFile("INFO Disabled logging to file.");
+ if (File.Exists(Path.Combine(GlobalVars.exeloc, "envyupdate.log")))
+ File.Move(Path.Combine(GlobalVars.exeloc, "envyupdate.log"), Path.Combine(GlobalVars.exeloc, "envyupdate.old.log"));
+ Debug.isVerbose = false;
+ }
}
}
diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs
index cd86d62..b6344c6 100644
--- a/EnvyUpdate/MainWindow.xaml.cs
+++ b/EnvyUpdate/MainWindow.xaml.cs
@@ -37,11 +37,16 @@ namespace EnvyUpdate
// This is necessary, since .NET throws an exception if you check for a non-existant arg.
}
- if (Debug.isVerbose)
+ // Check if Debug file exists
+ if (File.Exists(Path.Combine(GlobalVars.exedirectory, "envyupdate.log")))
{
- File.AppendAllText(Debug.debugFile, "INFO Starting EnvyUpdate, version " + System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion);
+ 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);
+
// Check if EnvyUpdate is already running
if (Util.IsInstanceOpen("EnvyUpdate"))
{
@@ -95,7 +100,7 @@ namespace EnvyUpdate
else
textblockLocalType.Text = "Standard";
- Debug.LogToFile("INFO Done detecting driver type.");
+ 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")))
@@ -189,7 +194,7 @@ namespace EnvyUpdate
}
catch (ArgumentException)
{
- Debug.LogToFile("WARN Could not get GPU update URL, trying again with standard driver.");
+ Debug.LogToFile("WARN Could not get GPU update URL, trying again with non-studio driver.");
try
{
// disable SD and try with GRD
@@ -202,6 +207,11 @@ namespace EnvyUpdate
MessageBox.Show(Properties.Resources.ui_studionotsupported);
radioGRD.IsChecked = true;
}
+ 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.
diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs
index 328a24d..e4587e0 100644
--- a/EnvyUpdate/Util.cs
+++ b/EnvyUpdate/Util.cs
@@ -132,7 +132,7 @@ namespace EnvyUpdate
Environment.Exit(2);
}
- public static int GetIDs(string IDtype)
+ public static int GetIDs(string IDtype, bool retry = true)
{
string xmlcontent = null;
int id = -1;
@@ -154,7 +154,6 @@ namespace EnvyUpdate
Debug.LogToFile("INFO Got Nvidia GPU list.");
if (xmlcontent == null)
{
- Debug.LogToFile("WARN GPU list is NULL! This is a possible error source.");
switch (IDtype)
{
case "osid":
@@ -162,8 +161,22 @@ namespace EnvyUpdate
Debug.LogToFile("WARN Ignore previous warning, just getting osid.");
Debug.LogToFile("INFO Got osid: " + id);
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();
+ }
+ break;
default:
- Debug.LogToFile("WARN GetIDs was called, but nothing was specified.");
+ Debug.LogToFile("WARN GetIDs was called, but nothing was specified. THIS SHOULD NOT HAPPEN!");
break;
}
}
@@ -224,7 +237,7 @@ namespace EnvyUpdate
}
else
{
- Debug.LogToFile("DEBUG Getting something else than psid.");
+ Debug.LogToFile("DEBUG Getting something other than psid.");
string result = name.Parent.Value.ToLower();
int index = result.IndexOf(sName);