private void Start() { try { new Thread(() => { try { ThreadRun(); } catch (Exception e) { logger?.Log("ATC", null, "Uncaught Exception: " + e); ATCModule.ShowExtMessage("Uncaught Exception in ATC", e.ToString()); _mainTask.SetErrored(); } }).Start(); } catch (Exception e) { logger?.Log("ATC", null, "Uncaught Exception: " + e); ATCModule.ShowExtMessage("Uncaught Exception in ATC", e.ToString()); _mainTask.SetErrored(); logger.SaveAll(); } }
public void Start() { try { var args = new CommandLineArguments(Environment.GetCommandLineArgs(), false); var doAWC = !args.Contains("runonly") || args.GetStringDefault("runonly", "").ToLower() == "awc"; var doDPS = !args.Contains("runonly") || args.GetStringDefault("runonly", "").ToLower() == "dips"; var doTVC = !args.Contains("runonly") || args.GetStringDefault("runonly", "").ToLower() == "tvc"; var doCSE = !args.Contains("runonly") || args.GetStringDefault("runonly", "").ToLower() == "cse"; config.load(logger); var awc = new AutoWallChange(logger, config.settings.awc, workingDirectory); var dips = new DesktopIconPositionSaver(logger, config.settings.dips, workingDirectory); var tvc = new TextVersionControl(logger, config.settings.tvc, workingDirectory); var cse = new CronScriptExecutor(logger, config.settings.cse, workingDirectory); if (doAWC) { awc.Init(new ATCTaskProxy("AutoWallChange", "AWC")); } if (doDPS) { dips.Init(new ATCTaskProxy("DesktopIconPositionSaver", "DIPS")); } if (doTVC) { tvc.Init(new ATCTaskProxy("TextVersionControl", "TVC")); } if (doCSE) { cse.Init(new ATCTaskProxy("CronScriptExecutor", "CSE")); } if (doAWC) { awc.Start(); } Thread.Sleep(500); if (doDPS) { dips.Start(); } Thread.Sleep(500); if (doTVC) { tvc.Start(); } Thread.Sleep(500); if (doCSE) { cse.Start(); } Thread.Sleep(500); config.save(); #if DEBUG System.Console.WriteLine(); System.Console.WriteLine("Prease any key to quit..."); System.Console.ReadLine(); #endif } catch (Exception e) { logger.Log("ATC", null, "Uncaught Exception: " + e); ATCModule.ShowExtMessage("Uncaught Exception in ATC", e.ToString()); } finally { logger.SaveAll(); } }