Initial commit of version 0.9.5.2; no older versions exist for this repo.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AdvertsingProfitControl
|
||||
{
|
||||
class GlobalClasses
|
||||
{
|
||||
|
||||
public static void LogError(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
{
|
||||
using (
|
||||
StreamWriter file =
|
||||
new StreamWriter(@"C:\Users\" + Environment.UserName + @"\AppData\Local\APC\" + DateTime.Now.ToString("MM-dd-yyyy") + ".log", true))
|
||||
{
|
||||
file.WriteLine(DateTime.Now + ": Unhandled Thread Exception:\n" + e.Exception.Message + "\n" + e.Exception.StackTrace);
|
||||
MessageBox.Show("An unhandled thread exception has occurred. Advertising Profit Control will be forced to exit.",
|
||||
"Fatal Error");
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void LogError(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
using (
|
||||
StreamWriter file =
|
||||
new StreamWriter(@"C:\Users\" + Environment.UserName + @"\AppData\Local\APC\" + DateTime.Now.ToString("MM-dd-yyyy") + ".log", true))
|
||||
{
|
||||
file.WriteLine(DateTime.Now + ": An unhandled exception occurred. \nException Object: " + e.ExceptionObject);
|
||||
MessageBox.Show("And unknown error has occurred. Advertising Profit Control will be forced to exit.",
|
||||
"Fatal Error");
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteToLog(string message)
|
||||
{
|
||||
using (
|
||||
StreamWriter file =
|
||||
new StreamWriter(@"C:\Users\" + Environment.UserName + @"\AppData\Local\APC\Information.log", true))
|
||||
{
|
||||
file.WriteLine(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user