diff --git a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin index fde47f19..8e7ee763 100644 Binary files a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin and b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin differ diff --git a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin index 9c2379cf..05535626 100644 Binary files a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin and b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin differ diff --git a/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 b/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 index 34c4e757..2c3c985a 100644 Binary files a/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 and b/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/216e694a-f2d5-41c2-a0ad-3713fdc5b565.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/216e694a-f2d5-41c2-a0ad-3713fdc5b565.vsidx new file mode 100644 index 00000000..f7b3a172 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/216e694a-f2d5-41c2-a0ad-3713fdc5b565.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/37c8d592-40d1-4392-a70d-c252b19d2951.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/37c8d592-40d1-4392-a70d-c252b19d2951.vsidx deleted file mode 100644 index b549f360..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/37c8d592-40d1-4392-a70d-c252b19d2951.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/3c4bd804-47b7-49fe-8655-5f8fa36d62b9.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/3c4bd804-47b7-49fe-8655-5f8fa36d62b9.vsidx deleted file mode 100644 index 3c1f5f14..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/3c4bd804-47b7-49fe-8655-5f8fa36d62b9.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/7636cfd3-8e9f-4f0c-a2d4-c9d5c0908502.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/7636cfd3-8e9f-4f0c-a2d4-c9d5c0908502.vsidx new file mode 100644 index 00000000..3865b1e7 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/7636cfd3-8e9f-4f0c-a2d4-c9d5c0908502.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/afe9ccda-b318-4b04-81c6-637c70b55c4a.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/afe9ccda-b318-4b04-81c6-637c70b55c4a.vsidx deleted file mode 100644 index df9c023b..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/afe9ccda-b318-4b04-81c6-637c70b55c4a.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/d584e337-271c-4f0b-86b3-50ad0ec53c9d.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/d584e337-271c-4f0b-86b3-50ad0ec53c9d.vsidx new file mode 100644 index 00000000..1a96eba2 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/d584e337-271c-4f0b-86b3-50ad0ec53c9d.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/dc5e13bb-7a95-4bd1-b35f-d744f01af283.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/dc5e13bb-7a95-4bd1-b35f-d744f01af283.vsidx new file mode 100644 index 00000000..b77dca85 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/dc5e13bb-7a95-4bd1-b35f-d744f01af283.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/df859033-3ffa-444d-9c08-de2d27c12ad2.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/df859033-3ffa-444d-9c08-de2d27c12ad2.vsidx new file mode 100644 index 00000000..86fb060f Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/df859033-3ffa-444d-9c08-de2d27c12ad2.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/e1dd01bf-9f7f-43b3-b2ce-3ff6b2b7a212.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/e1dd01bf-9f7f-43b3-b2ce-3ff6b2b7a212.vsidx deleted file mode 100644 index 7f482da8..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/e1dd01bf-9f7f-43b3-b2ce-3ff6b2b7a212.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/f722d97a-ad3a-4865-8cba-45e106ecf27b.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/f722d97a-ad3a-4865-8cba-45e106ecf27b.vsidx deleted file mode 100644 index be8b73df..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/f722d97a-ad3a-4865-8cba-45e106ecf27b.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 b/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 index 9e304375..c848d4fd 100644 Binary files a/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 and b/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 differ diff --git a/VTOL_2.0.0/MainWindow.xaml.cs b/VTOL_2.0.0/MainWindow.xaml.cs index 713735b5..2a2d622e 100644 --- a/VTOL_2.0.0/MainWindow.xaml.cs +++ b/VTOL_2.0.0/MainWindow.xaml.cs @@ -136,10 +136,17 @@ public string ProductVersion return file.Substring(0, file.IndexOf("+") + 1).Replace("+", ""); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return "1.0.0"; } @@ -758,12 +765,17 @@ private void Log_Folder_warning_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Main_Win_Control_GotFocus(object sender, RoutedEventArgs e) @@ -842,9 +854,17 @@ private void Changelog_Click(object sender, RoutedEventArgs e) catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Troubleshoot_Click(object sender, RoutedEventArgs e) @@ -1053,13 +1073,17 @@ private void Main_Win_Control_StateChanged(object sender, EventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } diff --git a/VTOL_2.0.0/Pages/Page_Home.xaml.cs b/VTOL_2.0.0/Pages/Page_Home.xaml.cs index 06387835..13b5898c 100644 --- a/VTOL_2.0.0/Pages/Page_Home.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Home.xaml.cs @@ -247,11 +247,17 @@ public static void GetInstalledApps() } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } } @@ -481,12 +487,17 @@ public Page_Home() Check_Log_Folder(); } catch (Exception ex) - { - - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public static bool IsDirectoryValid(string directoryPath) @@ -529,9 +540,17 @@ public static bool IsDirectoryValid(string directoryPath) File.Delete(testFilePath); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - return false; + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return false; } } else @@ -566,10 +585,17 @@ public bool TryUnzipFile( return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -612,11 +638,17 @@ public string[] FindFirstFiles(string path, string searchPattern) files = Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - return Array.Empty(); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return Array.Empty(); } // If matching files have been found, return the first one. @@ -635,9 +667,17 @@ public string[] FindFirstFiles(string path, string searchPattern) directories = Directory.GetDirectories(path); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - return Array.Empty(); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return Array.Empty(); } // Iterate through each directory and call the method recursivly. @@ -659,10 +699,17 @@ public string[] FindFirstFiles(string path, string searchPattern) catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} // If no file was found (neither in this directory nor in the child directories) // simply return string.Empty. return null; @@ -711,10 +758,17 @@ void Open_Folder(string Folder) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public string ProductVersion { @@ -726,10 +780,17 @@ public string ProductVersion return file.Substring(0, file.IndexOf("+") + 1).Replace("+", ""); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return "1.0.0"; } @@ -815,9 +876,17 @@ async void Auto_Install_(bool resart_ = false) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -1211,11 +1280,17 @@ void INIT() } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } Directory_Box.Text = Current_Install_Folder; @@ -1273,11 +1348,17 @@ void INIT() } } catch (Exception ex) - { - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public bool IsValidPath(string path, bool allowRelativePaths = false) @@ -1303,10 +1384,17 @@ public bool IsValidPath(string path, bool allowRelativePaths = false) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - isValid = false; + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");isValid = false; //Send_Fatal_Notif(GetTextResource("NOTIF_FATAL_COMMON_LOG")); //Write_To_Log(ErrorManager(ex)); } @@ -1329,8 +1417,6 @@ public string Read_From_TextFile_OneLine(string Filepath) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND") + Filepath); - //Write_To_Log(ErrorManager(e)); } @@ -1410,10 +1496,17 @@ private string Auto_Find_And_verify(string path = @"C:\ProgramData\Microsoft\Win if (originReg.GetValue("Install Dir") != null) return (string)originReg.GetValue("Install Dir"); } catch(Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} //Titanfall2_Directory_TextBox.Background = Brushes.Red; //Install_NS_EXE_Textbox.Background = Brushes.Red; @@ -1554,8 +1647,16 @@ public bool Template_traverse(DirectoryInfo root, String Search) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -1564,10 +1665,17 @@ public bool Template_traverse(DirectoryInfo root, String Search) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - if (ex.Message == "Sequence contains no elements") + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");if (ex.Message == "Sequence contains no elements") { DirectoryInfo Dir = new DirectoryInfo(outt); @@ -1655,10 +1763,17 @@ void Toggle_MS_BT(bool f) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -1805,12 +1920,17 @@ void Check_Log_Folder() } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } async void Log_Changes_Timer_Tick(object sender, EventArgs e) { @@ -1905,10 +2025,17 @@ void Check_For_New_Northstar_Install_With_Notif() } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} @@ -1929,10 +2056,17 @@ async void UPDATES_TIMER_Tick(object sender, EventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -2096,10 +2230,17 @@ public async Task PingHost() } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - DispatchIfNecessary(async () => + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");DispatchIfNecessary(async () => { LastHourSeries[0].Values.Add(new ObservableValue(0)); @@ -2436,8 +2577,16 @@ void WalkDirectoryTree(DirectoryInfo root, String Search) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -2446,9 +2595,17 @@ void WalkDirectoryTree(DirectoryInfo root, String Search) } catch (NullReferenceException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } @@ -2538,10 +2695,17 @@ private void Origin_Client_Card_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -2654,9 +2818,16 @@ async void Run_Origin() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } } @@ -2769,9 +2940,17 @@ async void Run_Origin() EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#99630000"); EA_ORGIGIN_Client_Card.IconFilled = false; - }); - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + }); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } } @@ -2867,9 +3046,17 @@ private void Browse_Titanfall_Button_Click(object sender, RoutedEventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } } @@ -3209,9 +3396,17 @@ private void Parse_Release(string json_name = "temp.json") } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. return; } @@ -3286,9 +3481,17 @@ void Check_For_New_Northstar_Install() } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } @@ -3368,10 +3571,17 @@ async Task Install_NS_METHOD() } } catch (Exception ex) - { - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. if (ex.Message.Contains("The remote server returned an error: (403) rate limit exceeded")) { @@ -3425,19 +3635,34 @@ public string GetFile(string directory, string Search, } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { Thread.Sleep(millisecondsDelay); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } return null; @@ -3518,9 +3743,17 @@ private void Completed(object sender, AsyncCompletedEventArgs e) if (ex.Message.Contains("is denied")) { Admin_Warn_Flag++; - } - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + } + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. DispatchIfNecessary(async () => { Fade_In_Fade_Out_Control(false); @@ -3570,10 +3803,17 @@ public async Task TryDeleteDirectory(string directoryPath, bool overwrite return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -3606,10 +3846,17 @@ public async Task TryCreateDirectory( return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -3644,11 +3891,17 @@ public async Task TryMoveFile( return true; } catch (IOException ex) - { - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -3682,10 +3935,17 @@ public async Task TryMoveFolder( return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -3720,10 +3980,17 @@ public async Task TryCopyFile( return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -3962,12 +4229,17 @@ private void Unpack_To_Location(string Target_Zip, string Destination_Zip) ProgressBar.Value = 0; - }); - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + }); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} @@ -3987,14 +4259,17 @@ private void Update_Northstar_Button_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} //BackgroundWorker worker = new BackgroundWorker(); //worker.DoWork += (sender, e) => //{ @@ -4138,10 +4413,17 @@ private void EXE_BUTTON_MouseLeave(object sender, MouseEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Warning_Sin_Loaded(object sender, RoutedEventArgs e) @@ -4152,10 +4434,17 @@ private void Warning_Sin_Loaded(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void StartPulseAnimation(double minimumOpacity) @@ -4179,10 +4468,17 @@ private void StartPulseAnimation(double minimumOpacity) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public void EditExe(string exePath) { @@ -4197,10 +4493,17 @@ public void EditExe(string exePath) Restart_App(); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void EXE_BUTTON_Click(object sender, RoutedEventArgs e) { @@ -4215,10 +4518,17 @@ private void EXE_BUTTON_Click(object sender, RoutedEventArgs e) Restart_App(); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Welcome_Close_Click(object sender, RoutedEventArgs e) @@ -4233,10 +4543,17 @@ private void Welcome_Close_Click(object sender, RoutedEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Locate_Titanfall_Install_Click(object sender, RoutedEventArgs e) @@ -4375,10 +4692,17 @@ private void Locate_Titanfall_Install_Click(object sender, RoutedEventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } } } diff --git a/VTOL_2.0.0/Pages/Page_Mods.xaml.cs b/VTOL_2.0.0/Pages/Page_Mods.xaml.cs index f41b40ca..03862a44 100644 --- a/VTOL_2.0.0/Pages/Page_Mods.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Mods.xaml.cs @@ -216,8 +216,16 @@ private static MainWindow GetMainWindow() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -330,8 +338,16 @@ public List READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -439,8 +455,16 @@ public List READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } @@ -451,10 +475,17 @@ public List READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo } } catch (Exception ex) - { + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - return OUTPUT; + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return OUTPUT; } return OUTPUT; @@ -602,10 +633,17 @@ public async Task Call_Mods_From_Folder() } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } Main.loaded_mods = true; @@ -628,10 +666,17 @@ public async Task Call_Mods_From_Folder() } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -889,8 +934,16 @@ public bool Template_traverse(System.IO.DirectoryInfo root, String Search) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } // Resursive call for each subdirectory. @@ -954,9 +1007,17 @@ public bool IsValidPath(string path, bool allowRelativePaths = false) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - isValid = false; + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");isValid = false; } return isValid; @@ -985,10 +1046,17 @@ private void ApplyDataBinding() } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public void Move_Mods(string val, bool Enable_Disable) @@ -1075,10 +1143,17 @@ public void Move_Mods(string val, bool Enable_Disable) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -1125,11 +1200,17 @@ private void Mod_Btn_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public void ComboBox_Actions() { @@ -1258,10 +1339,17 @@ public void ComboBox_Actions() } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { @@ -1469,10 +1557,17 @@ IEnumerable Keep_List_State(bool Searching, bool reverse = false) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return Final_List.OrderByDescending(ob => ob.Mod_Name_); } @@ -1519,11 +1614,17 @@ private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEvent } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } void Check_Reverse(bool Apply_Change = true) { @@ -1568,11 +1669,17 @@ void Check_Reverse(bool Apply_Change = true) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void padd_Click(object sender, RoutedEventArgs e) { @@ -1591,10 +1698,16 @@ private void padd_Click(object sender, RoutedEventArgs e) catch (Exception ex) { //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Mod_List_Box_GotFocus(object sender, RoutedEventArgs e) @@ -1641,10 +1754,17 @@ public static string FindFirstFile(string path, string searchPattern) files = Directory.GetFiles(path, searchPattern, SearchOption.TopDirectoryOnly); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - return string.Empty; + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return string.Empty; } // If matching files have been found, return the first one. @@ -1683,8 +1803,16 @@ public static string FindFirstFile(string path, string searchPattern) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -1715,10 +1843,17 @@ public long GetDirectorySize(string path) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return 0; } @@ -1737,10 +1872,17 @@ public string SizeSuffix(long value) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return null; } public static List ParseDirectoryStrings(string filePath, HashSet folderNames) @@ -1761,8 +1903,16 @@ public static List ParseDirectoryStrings(string filePath, HashSet } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -1943,10 +2093,17 @@ void Open_Mod_Info(string FolderDir) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} @@ -1966,10 +2123,17 @@ void Open_Folder(string Folder) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -2001,10 +2165,17 @@ private void Info_Btn_Click(object sender, RoutedEventArgs e) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Delete_Btn_Click(object sender, RoutedEventArgs e) @@ -2035,10 +2206,17 @@ private void Delete_Btn_Click(object sender, RoutedEventArgs e) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private childItem FindVisualChild(DependencyObject obj) where childItem : DependencyObject @@ -2065,10 +2243,17 @@ private childItem FindVisualChild(DependencyObject obj) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return null; } string temp_Dir; @@ -2108,10 +2293,17 @@ void Delete_Mod(string Mod_name, string FolderDir) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -2130,11 +2322,17 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e) // Read the JSON file string jsonContent = File.ReadAllText(Json_Path); - if (jsonContent.IsNullOrEmpty() != true && jsonContent.Length > 5) + + if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length > 2 || jsonContent == "null") {// Parse the JSON content - JObject jsonObject = JObject.Parse(jsonContent); + jsonContent = "{\t\t\n\n}"; + //File.WriteAllText(Json_Path, "{\t\t\n\n}"); + + } + + JObject jsonObject = JObject.Parse(jsonContent); string Name = workingmod; if (jsonObject.TryGetValue(Name, out _)) { @@ -2149,15 +2347,12 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e) // Write back to the file File.WriteAllText(Json_Path, updatedJson); - } - else - { - File.WriteAllText(Json_Path, "{\t\t\n\n}"); + } - } + string delete_mod_path = Dialog.Tag.ToString(); if (Directory.Exists(temp_Dir)) @@ -2175,12 +2370,17 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e) temp_Dir = null; } catch (Exception ex) - { - Console.WriteLine(ex + $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -2260,10 +2460,17 @@ private void EXTRA_SETTINGS_Dock_MouseRightButtonDown(object sender, MouseButton } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void CardControl_Loaded(object sender, RoutedEventArgs e) @@ -2289,10 +2496,17 @@ private void CardControl_Loaded(object sender, RoutedEventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void CardControl_IsMouseCaptureWithinChanged(object sender, DependencyPropertyChangedEventArgs e) { @@ -2377,11 +2591,17 @@ public string Search_For_Mod_Thunderstore(string SearchQuery = "None") } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return null; } private void DialogF_ButtonLeftClick(object sender, RoutedEventArgs e) @@ -2644,8 +2864,16 @@ await Task.Run(async () => //Task.Run automatically unwraps nested Task types! } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -2803,10 +3031,17 @@ private void Page_Loaded(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } } } diff --git a/VTOL_2.0.0/Pages/Page_Settings.xaml.cs b/VTOL_2.0.0/Pages/Page_Settings.xaml.cs index 71916e4d..475287ca 100644 --- a/VTOL_2.0.0/Pages/Page_Settings.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Settings.xaml.cs @@ -288,12 +288,17 @@ private void Settings_LostFocus(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } diff --git a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs index d4f9a532..620eaa02 100644 --- a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs @@ -1,5 +1,6 @@ using Downloader; using FuzzyString; +using Lsj.Util.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; @@ -195,10 +196,17 @@ public bool TryDeleteDirectory( return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -236,10 +244,17 @@ public bool TryCreateDirectory( } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -273,10 +288,17 @@ public bool TryMoveFile( return true; } catch (IOException ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - Thread.Sleep(millisecondsDelay); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -524,10 +546,17 @@ public void Install_Skin_From_Path(string Zip_Path) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -553,10 +582,17 @@ private void FindSkinFiles(string FolderPath, List FileList, string File } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -892,8 +928,16 @@ public async Task SaveHSetAsync() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -963,9 +1007,17 @@ public HashSet ReadHSet(string filePath, bool checkexisting = false) return result; } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - return result; + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return result; } @@ -1007,10 +1059,17 @@ private void mask_MouseLeave(object sender, MouseEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void CardExpander_MouseLeftGrid_Down(object sender, MouseButton e) @@ -1216,8 +1275,16 @@ protected void SomeWorkerThread(object o) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -1267,11 +1334,17 @@ public async Task Call_Ts_Mods() } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } static int versionCompare(string v1, string v2) { @@ -1422,8 +1495,16 @@ private void Compare_Mod_To_List(string modname, string Mod_version_current, Has } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } @@ -1433,11 +1514,16 @@ private void Compare_Mod_To_List(string modname, string Mod_version_current, Has } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} label = res; @@ -1508,11 +1594,16 @@ private void padd_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } void Check_Reverse(bool Apply_Change = true) { @@ -1557,11 +1648,17 @@ void Check_Reverse(bool Apply_Change = true) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public async Task TryDeleteDirectory(string directoryPath, bool overwrite = true, @@ -2459,10 +2556,17 @@ public string Search_For_Mod_Thunderstore(string SearchQuery = "None") } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return null; } @@ -2721,8 +2825,16 @@ void Dependency_Download(string Dependencies_To_Find_And_Download, ProgressBar P } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } // await Download_Zip_To_Path(y, User_Settings_Vars.NorthstarInstallLocation + @"NS_Downloaded_Mods", Progress_Bar); @@ -2735,10 +2847,17 @@ void Dependency_Download(string Dependencies_To_Find_And_Download, ProgressBar P } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} Dialog.Hide(); } @@ -2778,9 +2897,17 @@ private void CardAction_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public static bool IsDirectoryEmpty(DirectoryInfo directory) { @@ -2987,9 +3114,17 @@ public async Task IsValidPath(string path, bool allowRelativePaths = false } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - isValid = false; + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");isValid = false; } return isValid; @@ -3058,8 +3193,16 @@ async Task Call_Mods_From_Folder_Lite() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -3075,9 +3218,17 @@ async Task Call_Mods_From_Folder_Lite() } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public void SlowBlink(Control control, double minimumOpacity) @@ -3166,8 +3317,16 @@ public static void MoveDirectory___(string source, string target) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -3186,11 +3345,17 @@ public static string FindFirstFile(string path, string searchPattern) files = Directory.GetFiles(path, searchPattern, SearchOption.TopDirectoryOnly); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - - return string.Empty; + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return string.Empty; } // If matching files have been found, return the first one. @@ -3227,8 +3392,16 @@ public static string FindFirstFile(string path, string searchPattern) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -3575,6 +3748,14 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio // Read the JSON file string jsonContent = File.ReadAllText(Json_Path); + if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length > 2 || jsonContent == "null") + {// Parse the JSON content + + + jsonContent = "{\t\t\n\n}"; + //File.WriteAllText(Json_Path, "{\t\t\n\n}"); + + } // Parse the JSON content JObject jsonObject = JObject.Parse(jsonContent); @@ -3617,7 +3798,6 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio else { - Console.WriteLine("Candidate Detected ------\n\n\n\n\n"); DispatchIfNecessary(async () => { @@ -3694,8 +3874,16 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -3843,10 +4031,17 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio { Progress_Bar.Value = 0; } - }); - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + }); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public string ProductVersion { @@ -3858,10 +4053,17 @@ public string ProductVersion return file.Substring(0, file.IndexOf("+") + 1).Replace("+", ""); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return "0.0.0"; } @@ -3907,8 +4109,16 @@ private string Find_Folder(string searchQuery, string folderPath) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } } @@ -4005,9 +4215,17 @@ private async Task ExecuteQueueAsync() // Download was cancelled } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} finally { // _myClass.Action_Center.RemoveAll(card => card.Description == item.DestinationPath); @@ -4055,9 +4273,17 @@ private async Task DownloadZipAsync(DownloadQueueItem item, CancellationToken ca } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public void CancelDownload(string name, bool clear_all = false) @@ -4108,8 +4334,16 @@ public void CancelDownload(string name, bool clear_all = false) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - continue; + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); } @@ -4158,9 +4392,17 @@ public void CancelDownload(string name, bool clear_all = false) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } } @@ -4227,12 +4469,17 @@ private void Install_Bttn_Thunderstore_Click(object sender, RoutedEventArgs e) }); } catch (Exception ex) - { - - - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } async void Reload_Search() @@ -4306,11 +4553,17 @@ private void TextInput_OnKeyUpDone(object sender, ElapsedEventArgs e) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - + //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEventArgs e) { @@ -4470,11 +4723,16 @@ private void Search_Filters_SelectionChanged(object sender, SelectionChangedEven } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } async Task OPEN_WEBPAGE(string URL) @@ -4502,11 +4760,16 @@ await Task.Run(() => } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -4624,11 +4887,16 @@ private void Sort_SelectionChanged(object sender, SelectionChangedEventArgs e) } } catch (Exception ex) - { - - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -4696,11 +4964,16 @@ private void Grid_Loaded(object sender, RoutedEventArgs e) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -4803,11 +5076,16 @@ private void Thunderstore_Grid_Panel_Loaded(object sender, RoutedEventArgs e) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -4830,10 +5108,17 @@ private void SymbolIcon_MouseEnter(object sender, MouseEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -4858,10 +5143,17 @@ private void Favourite_MouseLeave(object sender, MouseEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -4903,10 +5195,17 @@ private void SymbolIcon_MouseDown(object sender, MouseButtonEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void SymbolIcon_Loaded(object sender, RoutedEventArgs e) @@ -4935,10 +5234,17 @@ private void SymbolIcon_Loaded(object sender, RoutedEventArgs e) }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } diff --git a/VTOL_2.0.0/Pages/Page_Tools.xaml.cs b/VTOL_2.0.0/Pages/Page_Tools.xaml.cs index 408caf60..ff58566b 100644 --- a/VTOL_2.0.0/Pages/Page_Tools.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Tools.xaml.cs @@ -614,9 +614,17 @@ YOUR DESCRIPTION Tools_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"VTOL_ExternalTools\"; } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -809,10 +817,17 @@ void create_Manifest(string Output_Folder) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } public async Task saveAsyncFile(string Text, string Filename, bool ForceTxt = true, bool append = true) { @@ -1112,9 +1127,17 @@ private void Save_Mod_Click(object sender, RoutedEventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } } @@ -1212,10 +1235,17 @@ private void Icon_Image_MouseDown(object sender, MouseButtonEventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } } @@ -1281,9 +1311,17 @@ void Process_Image(string path, string dir_out_) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } } @@ -1383,10 +1421,17 @@ private void Image_Icon_MouseDown(object sender, MouseButtonEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } } @@ -1496,9 +1541,17 @@ private void Image_Icon_Drop(object sender, DragEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } } @@ -1611,9 +1664,17 @@ private void Skin_Map_MouseDown(object sender, MouseButtonEventArgs e) } } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");//Removed PaperTrailSystem Due to lack of reliability. } } void add_Progress() @@ -1671,10 +1732,17 @@ void ProcessSkin() File.Delete(GetSkinPackRootPath()); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - return; + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");return; } } @@ -1842,10 +1910,17 @@ void ProcessSkin() SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; SnackBar.Message = ex.Message; - SnackBar.Show(); - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + SnackBar.Show(); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} @@ -2075,10 +2150,17 @@ private bool DdsToPng(string imagePath, string outputPath) SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; SnackBar.Message = ex.Message; - SnackBar.Show(); - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - } + SnackBar.Show(); + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} return false; } @@ -2496,10 +2578,17 @@ private void Tabs_SelectionChanged(object sender, SelectionChangedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Locate_Zip_Advocate_Click(object sender, RoutedEventArgs e) @@ -2542,10 +2631,17 @@ private void Locate_Zip_Advocate_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } @@ -2553,86 +2649,6 @@ private void Locate_Zip_Advocate_Click(object sender, RoutedEventArgs e) private void Image_Icon_Advocate_MouseDown(object sender, MouseButtonEventArgs e) { - //if (e.LeftButton == MouseButtonState.Pressed) - //{ - // try - // { - // OpenFileDialog openFileDialog = new OpenFileDialog(); - // openFileDialog.Filter = "Png files (*.png)|*.png|All files (*.*)|*.*"; - // openFileDialog.RestoreDirectory = true; - // if (openFileDialog.ShowDialog() == true) - // { - // Mod_Adv_Icon_Path = openFileDialog.FileName; - // if (!File.Exists(Mod_Adv_Icon_Path)) - // { - - // SnackBar.Icon = SymbolRegular.ErrorCircle20; - // SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - // SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_NotAValidPNGImage; - // SnackBar.Show(); - // return; - - // } - // else - // { - // if (Path.GetExtension(Mod_Adv_Icon_Path).Contains("png")) - // { - // int imgwidth; - // int imgheight; - - // using (var image = SixLabors.ImageSharp.Image.Load(Mod_Adv_Icon_Path)) - // { - // imgwidth = image.Width; - // imgheight = image.Height; - // } - - // if (imgwidth == 256 && imgheight == 256) - // { - - // SnackBar.Appearance = ControlAppearance.Success; - // SnackBar.Title = VTOL.Resources.Languages.Language.SUCCESS; - // SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_ValidImageFoundAt + Mod_Icon_Path; - // SnackBar.Show(); - // BitmapImage Mod_Icon = new BitmapImage(); - // Mod_Icon.BeginInit(); - - // Mod_Icon.UriSource = new Uri(Mod_Adv_Icon_Path); - // Mod_Icon.EndInit(); - - // Image_Icon_Advocate.Background = new ImageBrush(Mod_Icon); - - // } - // else - // { - // SnackBar.Icon = SymbolRegular.ErrorCircle20; - // SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - // SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_InvalidImageSizeMustBe256x256; - // SnackBar.Show(); - - // return; - - // } - - // } - // else - // { - // SnackBar.Icon = SymbolRegular.ErrorCircle20; - // SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - // SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_ThatWasNotAProperPNG; - // SnackBar.Show(); - - // return; - // } - // } - // } - - // } - // catch (Exception ex) - // { - // Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - // } - // } } private void Image_Icon_Advocate_Drop(object sender, DragEventArgs e) @@ -2709,10 +2725,17 @@ private void Image_Icon_Advocate_Drop(object sender, DragEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Locate_Repak_Exe_Click(object sender, RoutedEventArgs e) @@ -2757,10 +2780,17 @@ private void Locate_Repak_Exe_Click(object sender, RoutedEventArgs e) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } private void Output_Button_Advocate_Click(object sender, RoutedEventArgs e) @@ -2929,11 +2959,17 @@ await Task.Run(() => }); } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values - - } + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} @@ -2949,11 +2985,17 @@ void Open_Folder(string Folder) } catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}"); - - - } + { + var st = new System.Diagnostics.StackTrace(ex, true); + var frame = st.GetFrame(0); + var line = frame.GetFileLineNumber(); + var method = frame.GetMethod().Name; + var className = frame.GetMethod().DeclaringType.Name; + var variables = ""; // You would need to add logic to capture variable values + + Log.Fatal(ex, $"An error occurred at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}" + + $" Line Number: {line}, Method Name: {method}, Class Name: {className}, Variables: {variables}" + + $"{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");} } diff --git a/VTOL_2.0.0/Tools-Silhouette-Transparent.png b/VTOL_2.0.0/Tools-Silhouette-Transparent.png deleted file mode 100644 index 3a902bc6..00000000 Binary files a/VTOL_2.0.0/Tools-Silhouette-Transparent.png and /dev/null differ diff --git a/VTOL_2.0.0/UpgradeLog.htm b/VTOL_2.0.0/UpgradeLog.htm deleted file mode 100644 index fb728a21..00000000 --- a/VTOL_2.0.0/UpgradeLog.htm +++ /dev/null @@ -1,274 +0,0 @@ - - - - Migration Report -

- Migration Report -

\ No newline at end of file diff --git a/VTOL_2.0.0/UpgradeLog2.htm b/VTOL_2.0.0/UpgradeLog2.htm deleted file mode 100644 index d8deea92..00000000 Binary files a/VTOL_2.0.0/UpgradeLog2.htm and /dev/null differ diff --git a/VTOL_2.0.0/UpgradeLog3.htm b/VTOL_2.0.0/UpgradeLog3.htm deleted file mode 100644 index d8deea92..00000000 Binary files a/VTOL_2.0.0/UpgradeLog3.htm and /dev/null differ diff --git a/VTOL_2.0.0/UpgradeLog4.htm b/VTOL_2.0.0/UpgradeLog4.htm deleted file mode 100644 index d8deea92..00000000 Binary files a/VTOL_2.0.0/UpgradeLog4.htm and /dev/null differ diff --git a/VTOL_2.0.0/UpgradeLog5.htm b/VTOL_2.0.0/UpgradeLog5.htm deleted file mode 100644 index d8deea92..00000000 Binary files a/VTOL_2.0.0/UpgradeLog5.htm and /dev/null differ diff --git a/VTOL_2.0.0/UpgradeLog6.htm b/VTOL_2.0.0/UpgradeLog6.htm deleted file mode 100644 index d8deea92..00000000 Binary files a/VTOL_2.0.0/UpgradeLog6.htm and /dev/null differ diff --git a/VTOL_2.0.0/alternator.jpg b/VTOL_2.0.0/alternator.jpg deleted file mode 100644 index 951d6a32..00000000 Binary files a/VTOL_2.0.0/alternator.jpg and /dev/null differ diff --git a/VTOL_2.0.0/server-icon-download-icons-17.png b/VTOL_2.0.0/server-icon-download-icons-17.png deleted file mode 100644 index e0737534..00000000 Binary files a/VTOL_2.0.0/server-icon-download-icons-17.png and /dev/null differ