/// <summary> /// Save out the current list of received reports to disk /// </summary> void MemorizeReceivedReports() { var MemoPath = Path.Combine(Directory, MemoFilename); // Recreate the landing zone directory, just in case. System.IO.Directory.CreateDirectory(Directory); try { if (Interlocked.Exchange(ref MemoBeingWritten, 1) == 1) { return; } new XElement ( "Root", from Item in ReceivedReports.OrderBy(x => x.Value) select new XElement("CrashReport", Item.Key, new XAttribute("time", Item.Value.ToString())) ) .Save(MemoPath); CrashReporterReceiverServicer.WriteEvent("Saved to " + MemoPath); Interlocked.Exchange(ref MemoBeingWritten, 0); } catch (Exception Ex) { LogFile.Print("Failed to memorize received reports: " + Ex.Message); Interlocked.Exchange(ref MemoBeingWritten, 0); } }
/// <summary> /// Check whether a report of a given ID has already been through the landing zone /// </summary> /// <param name="ReportId">Report ID to check for</param> /// <returns>Whether the report of the given ID has been successfully uploaded before</returns> public bool HasReportAlreadyBeenReceived(string ReportId) { return(ReceivedReports.ContainsKey(ReportId)); }