/// <summary> /// Initialise all the components. /// </summary> public CrashReporterReceiverServicer() { InitializeComponent(); var StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Log = new CrashReportCommon.LogWriter( "CrashReportReceiver", Path.Combine( StartupPath, "Logs" ) ); }
/// <summary> /// Initialise all the components. /// </summary> public CrashReporterReceiverServicer() { InitializeComponent(); var StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Log = new CrashReportCommon.LogWriter("CrashReportReceiver", Path.Combine(StartupPath, "Logs")); }
/// <summary> /// Start the service, and stop the service if there were any errors found. /// </summary> /// <param name="Arguments">Command line arguments (unused).</param> protected override void OnStart(string[] Arguments) { // Create a log file for any start-up messages Log = new CrashReportCommon.LogWriter("CrashReportProcess", LogFolder); // Add directory watchers Watcher = new ReportWatcher(); Processor = new ReportProcessor(Watcher); WriteEvent("Successfully started at " + DateTime.Now.ToString()); }
/// <summary> /// Stop the service. /// </summary> protected override void OnStop() { // Clean up the directory watcher and crash processor threads Processor.Dispose(); Processor = null; Watcher.Dispose(); Watcher = null; // Flush the log to disk Log.Dispose(); Log = null; }
/// <summary> /// Constructor: set up a landing zone directory /// </summary> /// <param name="DirectoryToUse">Directory to store the WER sub-directories</param> /// <param name="Log">Optional file to write messages to</param> public LandingZoneMonitor(string DirectoryToUse, CrashReportCommon.LogWriter Log) { Directory = DirectoryToUse; LogFile = Log; DirectoryInfo DirInfo = new DirectoryInfo(Directory); if (DirInfo.Exists) { ReadMemorizedReceivedReports(); MemorizeReceivedReports(); } else { DirInfo.Create(); } LogFile.Print("Landing zone: " + DirectoryToUse); }