创建得辉达定制分支

This commit is contained in:
moxiliang
2025-06-21 10:00:45 +08:00
parent dcd9b20fb0
commit c189711a92
145 changed files with 96629 additions and 5073 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Windows.Forms;
namespace C_Windows_1
@@ -11,9 +12,37 @@ namespace C_Windows_1
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// 获取项目的 Debug 目录路径
string logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "error.txt");
using (FileStream efs = new FileStream(logFilePath, FileMode.Append))
{
byte[] data = System.Text.Encoding.Default.GetBytes("CurrentDomain_UnhandledException::" + e.ToString() + ",object:" + e.ExceptionObject.ToString());
efs.Write(data, 0, data.Length);
}
}
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
// 获取项目的 Debug 目录路径
string logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "error.txt");
using (FileStream efs = new FileStream(logFilePath, FileMode.Append))
{
byte[] data = System.Text.Encoding.Default.GetBytes("Application_ThreadException:" + e.ToString());
efs.Write(data, 0, data.Length);
}
}
}
}