private UploableErrorReportingEngine(string reportsFolderPath, int intervalOfDays, int maxNumberErrReport,bool addSnapshotToReport) { reportsFolder = new DirectoryInfo(Path.Combine(reportsFolderPath, "MiniReports")); PathUtils.TryCreatePath(reportsFolder.FullName); reportsToUploadFolder = reportsFolder.CreateSubdirectory("ToUpload"); uploadingReportsFolder = reportsFolder.CreateSubdirectory("Uploading"); processingFolder = reportsFolder.CreateSubdirectory("Processing"); lastSentItemsFileInfo = new FileInfo(Path.Combine(reportsFolder.FullName, LAST_SENT_ITEMS_FILE_NAME)); //try clear processing and uploading folder try { List<FileInfo> files = new List<FileInfo>(); //files.AddRange(uploadingReportsFolder.GetFiles("err*.zip")); //files.AddRange(uploadingReportsFolder.GetFiles("issue*.zip")); files.AddRange(uploadingReportsFolder.GetFiles("err*.*")); files.AddRange(uploadingReportsFolder.GetFiles("issue*.*")); foreach (FileInfo file in files) { file.MoveTo(Path.Combine(reportsToUploadFolder.FullName, file.Name)); } processingFolder.Delete(true); uploadingReportsFolder.Delete(true); processingFolder = reportsFolder.CreateSubdirectory("Processing"); uploadingReportsFolder = reportsFolder.CreateSubdirectory("Uploading"); } catch (Exception e) { ProcessException.Handle(e); Debug.WriteLine(e); } tools = new ProcessingJobsSharedTools(intervalOfDays, maxNumberErrReport, addSnapshotToReport, processingFolder, reportsToUploadFolder, uploadingReportsFolder, lastSentItemsFileInfo); PackageUploadManager.Initialize(tools); //Uploder uploader = new Uploder(PackageUploadManager.Instance); //uploader.TryDoUploads(); //return; ThreadPool.QueueUserWorkItem(delegate(object state) { Uploder uploader = new Uploder(PackageUploadManager.Instance); uploader.TryDoUploads(); }); }
public void CreateProcessingJob(ServerErrorReport errorReport) { ProcessException.Handle("CreateProcessingJob() -error report: " + errorReport); ReportProcessingJob processingJob =new ReportProcessingJob(tools, errorReport); processingJob.StartProcessing(); Uploder uploader = new Uploder(PackageUploadManager.Instance); uploader.TryDoUploads(); }