private bool IsValidReport(string inputReportFileName, out TestReportInfo testReportInfo) { bool reportIsValid = false; string sDate = ""; string sDateMdyy = ""; testReportInfo = new TestReportInfo(); if (!IsValidPN(inputReportFileName)) { return(reportIsValid); } sDate = ExtractDateFromFileName(inputReportFileName); if (sDate == "") { return(reportIsValid); } sDateMdyy = ConvertDateToMdyy(sDate); if (sDateMdyy == "") { return(reportIsValid); } testReportInfo.destRootFolder = mRootFolder + "\\" + sDateMdyy; testReportInfo.fileName = inputReportFileName; reportIsValid = true; return(reportIsValid); }
private void CreateListOfValidReportFiles() { List <TestReportInfo> lstOfMatchingFiles = new List <TestReportInfo>(); string[] tmp = Directory.GetFiles(mRootFolder, mReportFileExtension, SearchOption.TopDirectoryOnly); TestReportInfo testReportInfo = new TestReportInfo(); foreach (var item in tmp) { if (IsValidReport(Path.GetFileName(item), out testReportInfo)) { testReportInfo.filePath = item; testReportInfo.status = GetReportStatus(testReportInfo.filePath); testReportInfo.destRootFolder = testReportInfo.destRootFolder + "\\" + testReportInfo.status; if (testReportInfo.status != "") { if (!IsFileinUse(item)) { lstOfMatchingFiles.Add(testReportInfo); } } } } mTestreports = lstOfMatchingFiles.ToArray(); }