private bool ProcessFolder(string sFolder) { string[] sTestDataFiles = Directory.GetFiles(sFolder); string sShortName = string.Empty; foreach (string sSingleFileToTest in sTestDataFiles) { if (!IsFileWeShouldTest(sSingleFileToTest)) continue; try { if (m_abortFlag) throw new UserAbortException(); sShortName = System.IO.Path.GetFileName(sSingleFileToTest); m_sfct = new SingleFileCleaningTester(sSingleFileToTest); m_sfct.AdvancedOptions = m_advancedOptions; m_sfct.SetCallbackInfo(this, sShortName); if (m_sfct.Execute()) { string detail = ReportDiscoveryDifferenceDetail(sShortName); ReportItemComplete(m_sfct, detail); } } catch (UserAbortException) { ReportProgress("** User cancelled the test **"); SignalComplete(); return false; } catch (Exception e) { LogTheException(sShortName); string reportProgress = sShortName + "\r\n**** Exception caught ***" + e.Message + "\r\n" + CalculateDiscoveryDifferenceDetail(sShortName); ReportProgress(reportProgress); if (m_sfct.DocumentCorrupted) ItemComplete(sSingleFileToTest, m_sfct.BinCleanedFile, m_sfct.ApiCleanedFile, "Document possibly Corrupted by LightSpeed Redact: " + e.Message, GetAPICleanResult(), CleanResult.CorruptedDoc, reportProgress); else if (m_sfct.LightSpeedCleaningWorked) ItemComplete(sSingleFileToTest, m_sfct.BinCleanedFile, m_sfct.ApiCleanedFile, "API Clean Failed : " + e.Message, CleanResult.Crashed, GetLSCleanResult(), reportProgress); else ItemComplete(sSingleFileToTest, m_sfct.BinCleanedFile, m_sfct.ApiCleanedFile, "LightSpeed Redact Failed : " + e.Message, GetAPICleanResult(), CleanResult.Crashed, reportProgress); } } foreach (string s in Directory.GetDirectories(sFolder)) { if (!ProcessFolder(s)) return false; } return true; }
private void ReportItemComplete(SingleFileCleaningTester sfct, string detail) { ItemComplete(sfct.InputFile, sfct.ApiCleanedFile, sfct.BinCleanedFile, m_sSummary, GetAPICleanResult(), GetLSCleanResult(),detail); m_formParent.UpdatePerformance((int)sfct.FileSize, sfct.ApiCleaningTime, sfct.LightSpeedCleaningTime, sfct.StartCloseAppTime); }