/// <summary> /// Check to see if a report has already been uploaded. /// </summary> /// <param name="Request">A request containing either the Report Id as a string or an XML representation of a CheckReportRequest class instance.</param> /// <returns>Result object, indicating whether the report has already been uploaded.</returns> private CrashReporterResult CheckReport(HttpListenerRequest Request) { var ReportResult = new CrashReporterResult(); var RequestClass = new CheckReportRequest(); RequestClass.ReportId = GetReportIdFromPostData(GetContentStreamString(Request)); ReportResult.bSuccess = !LandingZone.HasReportAlreadyBeenReceived(RequestClass.ReportId); if (!ReportResult.bSuccess) { CrashReporterReceiverServicer.WriteEvent(string.Format("Report \"{0}\" has already been received", RequestClass.ReportId)); } return(ReportResult); }
/// <summary> /// Check to see if a report has already been uploaded. /// </summary> /// <param name="Request">A request containing either the Report Id as a string or an XML representation of a CheckReportRequest class instance.</param> /// <returns>Result object, indicating whether the report has already been uploaded.</returns> private CrashReporterResult CheckReport(HttpListenerRequest Request) { CrashReporterResult ReportResult = new CrashReporterResult(); #if DISABLED_CRR ReportResult.bSuccess = false; CrashReporterReceiverServicer.WriteEvent("CheckReport() Report rejected by disabled CRR"); #else var RequestClass = new CheckReportRequest(); RequestClass.ReportId = GetReportIdFromPostData(GetContentStreamString(Request)); ReportResult.bSuccess = !LandingZone.HasReportAlreadyBeenReceived(RequestClass.ReportId); if (!ReportResult.bSuccess) { CrashReporterReceiverServicer.WriteEvent(string.Format("Report \"{0}\" has already been received", RequestClass.ReportId)); } #endif return(ReportResult); }
/// <summary> /// Rename to the temporary landing zone directory to the final location. /// </summary> /// <param name="Request">A request containing either the Report Id as a string or an XML representation of a CheckReportRequest class instance.</param> /// <returns>true if everything is renamed correctly.</returns> private CrashReporterResult UploadComplete(HttpListenerRequest Request) { var ReportResult = new CrashReporterResult(); var RequestClass = new CheckReportRequest(); RequestClass.ReportId = GetReportIdFromPostData(GetContentStreamString(Request)); string IntermediatePathName = Path.Combine(FileReceiptPath, RequestClass.ReportId); if (!UploadsInProgress.TrySetReportComplete(RequestClass.ReportId)) { ReportResult.Message = string.Format("Report \"{0}\" has already been completed", RequestClass.ReportId); ReportResult.bSuccess = false; return(ReportResult); } DirectoryInfo DirInfo = new DirectoryInfo(IntermediatePathName); if (!DirInfo.Exists) { return(ReportResult); } LandingZone.ReceiveReport(DirInfo, RequestClass.ReportId); ReportResult.bSuccess = true; int CurrentDay = DateTime.UtcNow.Day; if (CurrentDay > LastDay) { // Check the log and create a new one for a new day. CrashReporterReceiverServicer.Log.CreateNewLogFile(); LastDay = CurrentDay; } return(ReportResult); }