protected override object Process()
        {
            //place in log that it is processing the list of files found in the directory.
            ReportProgress(new ProgressStatus(ProcessName, string.Format("Processing directory: {0}", m_SourceDirectory)));

            //obtain a list of files that meet log filter specifications
            fileEntries = Directory.GetFiles(m_SourceDirectory, LogFilter);

            //place in log number of files found in directory
            ReportProgress(new ProgressStatus(ProcessName, string.Format("{0} files found.", dccManiFilesProcessed)));
            if (fileEntries.Length != 0)
            {
                foreach (string fileName in fileEntries)
                {
                    //get process log file name from fileName string
                    ActualFileName = fileName.Substring(m_SourceDirectory.Length + 1);

                    //post to log the file being processed
                    ReportProgress(new ProgressStatus(ProcessName, string.Format("Processing file:{0} ...", ActualFileName)));

                    //check to see if the current file has already processed
                    if (!HasLogProcessed(ActualFileName))
                    {
                        //if not then run import method
                        ImportFile(fileName);
                    }
                    else
                    {
                        // otherwise log message that file already exists
                        ReportProgress(new ProgressStatus(ProcessName, string.Format("This log: {0} has already been processed and loaded to database", ActualFileName)));
                    }

                    Archiver compress = new Archiver();
                    compress.Zip(fileName, m_SourceDirectory);
                    compress.Zip(fileName.Replace(".log", ".Exceptions"), m_SourceDirectory);
                    //increment file counters
                    dccManiFilesProcessed++;
                    ReportProgress(new ProgressStatus(ProcessName, string.Format(" complete. {0} of {1} file(s) processed.", dccManiFilesProcessed, fileEntries.Length), dccManiFilesProcessed, fileEntries.Length));
                    if (dccManiFilesProcessed == fileEntries.Length)
                    {
                        DCCManiFilesComplete = true;
                    }
                    else
                    {
                        DCCManiFilesComplete = false;
                    }
                }
            }
            else
            {
                DCCManiFilesComplete = true;
            }
            return(null);
        }
示例#2
0
        protected override object Process()
        {
            //place in log that it is processing the list of files found in the directory.
            ReportProgress(new ProgressStatus(ProcessName, string.Format("Processing directory: {0}", m_SourceDirectory)));

            //obtain a list of files that meet log filter specifications
            fileEntries = Directory.GetFiles(m_SourceDirectory, LogFilter);

            //place in log number of files found in directory
            ReportProgress(new ProgressStatus(ProcessName, string.Format("{0} files found.", fileEntries.Length)));

            foreach (string fileName in fileEntries)
            {
                ftpFilesProcessed++;

                ActualFileName = fileName.Substring(m_SourceDirectory.Length);

                ReportProgress(new ProgressStatus(ProcessName, string.Format("Processing file:{0} ...", ActualFileName)));
                ReportProgress(new ProgressStatus(ProcessName, null, ftpFilesProcessed, fileEntries.Length));

                //check to see if current file has already processed
                if (!HasLogProcessed(ActualFileName))
                {
                    ImportFile(fileName);
                }
                else
                {
                    // otherwise place msg in log that file already exists
                    ReportProgress(new ProgressStatus(ProcessName, string.Format("This log: {0} has already been processed and loaded to database", ActualFileName)));
                }

                Archiver compress = new Archiver();
                compress.Zip(fileName, m_SourceDirectory);
                compress.Zip(fileName.Replace(".log", ".Exceptions"), m_SourceDirectory);

                ReportProgress(new ProgressStatus(ProcessName, string.Format(" complete. {0} file(s) processed.", ftpFilesProcessed), ftpFilesProcessed, fileEntries.Length));
            }

            return(null);
        }