using System; using System.IO; using System.ServiceProcess; using FilterAPI; using FilterZone.ZoneNetworking; namespace FilterZone { public partial class Service : ServiceBase { public Service() { } protected override void OnStart(String[] Args) { Program.ZoneID = AppDomain.CurrentDomain.FriendlyName.Replace("FilterZone", "").Replace(".exe", ""); Program.Auth = new Authentication(); Program.SQL = new Database(Program.Auth); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ZoneListener ZListen = new ZoneListener(); } private void CurrentDomain_UnhandledException(Object Sender, UnhandledExceptionEventArgs Args) { File.WriteAllLines(String.Format("{0}{1}Crash.txt", AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName.Replace(".exe", "")), new String[] { ((Exception)Args.ExceptionObject).ToString() }); } protected override void OnStop() { } } }