private static bool ExtractSourceFiles(BackgroundWorker backgroundWorker) { OutputMg.OutputHeader1(backgroundWorker, "Step 2", "Extract Source File"); OutputMg.OutputContent(backgroundWorker, "Start to count number under " + FileMg.AutoSourceFileDir); int sourceFileNumber = FileMg.CountFileNumber(FileMg.AutoSourceFileDir); OutputMg.OutputContent(backgroundWorker, "Finished counting. Total file number is: " + sourceFileNumber); OutputMg.OutputContent(backgroundWorker, "Start to extract files"); ExtractMg.ExtractFile(FileMg.AutoSourceFileDir, FileMg.AutoExtractTextFileDir, FileMg.AutoCleanTextFileDir, FileMg.AutoSemiCleanTextFileDir, FileMg.AutoTmtDataFileDir + Constants.TmtInputFileName, backgroundWorker); OutputMg.OutputContent(backgroundWorker, "Finished extracting files"); return(true); }
private static bool CopyRawFiles(BackgroundWorker backgroundWorker, string dirName) { OutputMg.OutputHeader1(backgroundWorker, "Step 1", "Copy Source File"); try { OutputMg.OutputContent(backgroundWorker, "Start to count number under " + dirName); int sourceFileNumber = FileMg.CountFileNumber(dirName); OutputMg.OutputContent(backgroundWorker, "Finished counting. Total file number is: " + sourceFileNumber); OutputMg.OutputContent(backgroundWorker, "Starting copy files"); int numCopy = FileMg.DirectoryCopy(dirName, FileMg.AutoSourceFileDir, true, false, backgroundWorker); OutputMg.OutputContent(backgroundWorker, "Finished copying files. Total file number is: " + numCopy); return(true); } catch { OutputMg.OutputHeader1(backgroundWorker, "Failed", "Copy files failed. Please try to run this tool as Administrator."); return(false); } }
private void CountFileNumber_DoWork(object sender, DoWorkEventArgs e) { mSourceFileNumber = FileMg.CountFileNumber(e.Argument.ToString()); e.Result = mSourceFileNumber; }