..
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Speech.Synthesis;
|
||||
using System.Media;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -184,6 +185,11 @@ namespace Project
|
||||
|
||||
public static void init()
|
||||
{
|
||||
// 전역 예외 처리기 등록
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
Application.ApplicationExit += Application_ApplicationExit;
|
||||
|
||||
Result = new CResult();
|
||||
|
||||
//state machine
|
||||
@@ -237,6 +243,47 @@ namespace Project
|
||||
else PUB.PatchVersion = string.Empty;
|
||||
}
|
||||
|
||||
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string errorMessage = $"Thread Exception: {e.Exception.Message}\nStack Trace: {e.Exception.StackTrace}";
|
||||
log.AddE(errorMessage);
|
||||
MessageBox.Show($"프로그램 오류가 발생했습니다.\n{errorMessage}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 로깅 실패 시 무시
|
||||
}
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Exception ex = e.ExceptionObject as Exception;
|
||||
string errorMessage = $"Unhandled Exception: {ex?.Message}\nStack Trace: {ex?.StackTrace}";
|
||||
log.AddE(errorMessage);
|
||||
MessageBox.Show($"프로그램 오류가 발생했습니다.\n{errorMessage}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 로깅 실패 시 무시
|
||||
}
|
||||
}
|
||||
|
||||
private static void Application_ApplicationExit(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
log.Add("프로그램 종료", "Application_ApplicationExit 이벤트 발생");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 로깅 실패 시 무시
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean CheckManualChargeMode(bool Prompt = true )
|
||||
{
|
||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
|
||||
|
||||
Reference in New Issue
Block a user