Пример #1
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            string zTDFFile = ((KeyValuePair <string, string>) this.cbxInput.SelectedItem).Key;
            IJob   zJob;

            // Create an instance for the phase retrieval job:
            zJob = new TDF2TIFFJob(
                zTDFFile,
                this.zOutputPathTxb.Text,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudTDFToTIFFFrom.Value) : 0,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudTDFToTIFFTo.Value) : Convert.ToInt32(this.nudTDFToTIFFTo.Maximum),
                (this.chkData.Checked) ? tbxProjectionPrefix.Text : "-",
                (this.tbxFlatPrefix.Enabled) ? ((this.chkDataWhite.Checked) ? tbxFlatPrefix.Text : "-") : "-",
                (this.tbxDarkPrefix.Enabled) ? ((this.chkDataDark.Checked) ? tbxDarkPrefix.Text : "-") : "-",
                this.rbtDirectOrder.Checked,
                this.btnTIFFFormat.Checked,
                1
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            if (chkData.Checked)
            {
                mJobMonitor.Run(zExecuter, tbxProjectionPrefix.Text);
            }
            else
            {
                if ((chkDataDark.Checked) && !(chkDataWhite.Checked))
                {
                    // Only darks are created:
                    mJobMonitor.Run(zExecuter, this.tbxDarkPrefix.Text, TDFReader.GetNumberOfDarks(zTDFFile));
                }
                else
                {
                    if (!(chkDataDark.Checked) && (chkDataWhite.Checked))
                    {
                        // Only flats are created:
                        mJobMonitor.Run(zExecuter, this.tbxFlatPrefix.Text, TDFReader.GetNumberOfFlats(zTDFFile));
                    }
                    else
                    {
                        // Both flats and darks are created but STP-Core first creates
                        // flats and then darks, so monitor the dark prefix:
                        mJobMonitor.Run(zExecuter, this.tbxDarkPrefix.Text, TDFReader.GetNumberOfDarks(zTDFFile));
                    }
                }
            }
        }
Пример #2
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IMonitoredJob zJob;

            // Check output file:
            if (File.Exists(Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar +
                            Path.GetFileNameWithoutExtension(txbOutputTDF.Text) + Properties.Settings.Default.TomoDataFormatExtension))
            {
                if (MessageBox.Show("The specified TDF file already exists. Overwrite it?", "SYRMEP Tomo Project",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                {
                    File.Delete(Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar +
                                Path.GetFileNameWithoutExtension(txbOutputTDF.Text) + Properties.Settings.Default.TomoDataFormatExtension);
                }
                else
                {
                    return;
                }
            }

            //mTempOutputName = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + "_" + Program.GetTimestamp(DateTime.Now) + ".tmp";
            mTempOutputName = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + txbOutputTDF.Text;

            // Create an instance for the phase retrieval job:
            zJob = new HIS2TDFJob(
                this.txbProjectionHIS.Text,
                this.txbDarkHIS.Text,
                this.txbFlatHIS.Text,
                this.txbPostDarkHIS.Text,
                this.txbPostFlatHIS.Text,
                mTempOutputName,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFFrom.Value) : 0,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFTo.Value) : Convert.ToInt32(this.nudConvertToTDFTo.Maximum),
                Convert.ToInt32(this.nudConvertToTDF_CropLeft.Value),
                Convert.ToInt32(this.nudConvertToTDF_CropRight.Value),
                Convert.ToInt32(this.nudConvertToTDF_CropTop.Value),
                Convert.ToInt32(this.nudConvertToTDF_CropBottom.Value),
                true,
                Convert.ToInt32(this.nudOutputCompression.Value)
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, Properties.Settings.Default.FormSettings_ProjectionPrefix);
        }
Пример #3
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            // Execute with conventional flat fielding:
            zJob = new PreProcessingJob(
                // Get combobox selection (in handler)
                this.mInputTDF,
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr.tdf",
                0,
                TDFReader.GetNumberOfSlices(mInputTDF) - 1,
                mAirSx,
                mAirDx,
                this.mFlatEnd,    // use flat at the end
                this.mHalfHalf,
                this.mHalfHalfLine,
                this.mExtFOV,
                this.mExtFOVRight,
                this.mExtFOVOverlap,
                this.mExtFOVNormalize,
                this.mExtFOVAverage,
                this.mRingRemoval,
                this.mDynamicFlatFielding,
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses),
                false,
                "-"
                );


            // Create an instance of JobExecuter with the pre processing job:
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job splitting it with several processes (if specified):
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, "sino");

            this.mPreProcessOnGoing = true;

            this.lblPreProcessing.Enabled  = true;
            this.lblPhaseRetrieval.Enabled = false;
            this.lblReconstruction.Enabled = false;

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }
Пример #4
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            //mTempOutputName = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + "_" + Program.GetTimestamp(DateTime.Now) + ".tmp";
            mTempOutputName = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + txbOutputTDF.Text;

            // Create an instance for the phase retrieval job:
            zJob = new EDF2TDFJob(
                mInputPath,
                mTempOutputName,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFFrom.Value) : 0,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFTo.Value) : Convert.ToInt32(this.nudConvertToTDFTo.Maximum),
                Convert.ToInt32(this.nudConvertToTDF_CropLeft.Value),
                Convert.ToInt32(this.nudConvertToTDF_CropRight.Value),
                Convert.ToInt32(this.nudConvertToTDF_CropTop.Value),
                Convert.ToInt32(this.nudConvertToTDF_CropBottom.Value),
                tbxProjectionPrefix.Text,
                tbxFlatPrefix.Text,
                tbxDarkPrefix.Text,
                (this.rbtInputSinograms.Checked) ? false : true,
                Convert.ToInt32(this.nudOutputCompression.Value),
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses)
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, this.tbxProjectionPrefix.Text);

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }
Пример #5
0
        private void runPhaseRetrieval(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            // Execute with conventional flat fielding:
            mPreProcessOnGoing     = false;
            mReconstructionOnGoing = false;

            // Execute with conventional flat fielding:
            zJob = new PhaseRetrievalJob(
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr.tdf",
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf",
                this.mMethod,
                0,
                TDFReader.GetNumberOfProjections(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr.tdf") - 1,
                this.mParam1,
                this.mParam2,
                this.mDistance,
                this.mEnergy,
                this.mPixelsize,
                this.mPad,
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses)
                );


            // Create an instance of JobExecuter with the pre processing job:
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job splitting it with several processes (if specified):
            zExecuter.Run();

            mJobMonitor.Run(zExecuter, "tomo");

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;

            mPhaseRetrievalOnGoing = true;
        }
Пример #6
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            // Run GDEI Job:
            IJob zJob;

            string zInputFile_1 = ((KeyValuePair <string, string>) this.cbxGDEI_Input2.SelectedItem).Key;
            string zInputFile_2 = ((KeyValuePair <string, string>) this.cbxGDEI_Input1.SelectedItem).Key;
            string zInputFile_3 = ((KeyValuePair <string, string>) this.cbxGDEI_Input3.SelectedItem).Key;

            String[] zSubStrings   = Path.GetFileName(zInputFile_1).Split('_');
            string   zOutputPrefix = string.Empty;

            for (int i = 0; i < zSubStrings.Length - 1; i++)
            {
                zOutputPrefix += zSubStrings[i];
            }

            string zOutputFile_Abs  = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + zOutputPrefix + "_abs" + Properties.Settings.Default.TomoDataFormatExtension;
            string zOutputFile_Refr = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + zOutputPrefix + "_ref" + Properties.Settings.Default.TomoDataFormatExtension;
            string zOutputFile_Sca  = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + zOutputPrefix + "_sca" + Properties.Settings.Default.TomoDataFormatExtension;

            // Create an instance for the phase retrieval job:
            zJob = new GDEIJob(
                zInputFile_1,
                zInputFile_2,
                zInputFile_3,
                zOutputFile_Abs,
                zOutputFile_Refr,
                zOutputFile_Sca,
                0,                                             //(this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFFrom.Value) : 0,
                TDFReader.GetNumberOfSlices(zInputFile_1) - 1, //-1, //(this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFTo.Value) : -1,
                this.mAirSx,
                this.mAirDx,
                this.mFlatEnd,
                this.mHalfHalf,
                this.mHalfHalfLine,
                this.mExtFOV,
                this.mExtFOVRight,
                this.mExtFOVOverlap,
                this.mExtFOVNormalize,
                this.mExtFOVAverage,
                this.mRingRemoval,
                this.mDynamicFlatFielding,
                Convert.ToInt32(this.nudGDEI_ShiftVert1.Value),
                Convert.ToInt32(this.nudGDEI_ShiftHoriz1.Value),
                Convert.ToInt32(this.nudGDEI_ShiftVert2.Value),
                Convert.ToInt32(this.nudGDEI_ShiftHoriz2.Value),
                Convert.ToInt32(this.nudGDEI_ShiftVert3.Value),
                Convert.ToInt32(this.nudGDEI_ShiftHoriz3.Value),

                Convert.ToDouble(this.nudGDEI_r1.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_r1Exp.Value)),
                Convert.ToDouble(this.nudGDEI_r2.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_r2Exp.Value)),
                Convert.ToDouble(this.nudGDEI_r3.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_r3Exp.Value)),

                Convert.ToDouble(this.nudGDEI_d1.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_d1Exp.Value)),
                Convert.ToDouble(this.nudGDEI_d2.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_d2Exp.Value)),
                Convert.ToDouble(this.nudGDEI_d3.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_d3Exp.Value)),

                Convert.ToDouble(this.nudGDEI_dd1.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_dd1Exp.Value)),
                Convert.ToDouble(this.nudGDEI_dd2.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_dd2Exp.Value)),
                Convert.ToDouble(this.nudGDEI_dd3.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_dd3Exp.Value)),

                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses)
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, "sino");

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }
Пример #7
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            IJob zJob;

            // Create an instance for the multi offset job:
            zJob = new MultiAngleJob(
                this.mSlicePrefix,
                this.mImageIndex,
                this.mInputTDF,
                this.zOutputPathTxb.Text,
                this.mPreProcess,
                this.mAirSx,
                this.mAirDx,
                this.mFlatEnd,
                this.mHalfHalf,
                this.mHalfHalfLine,
                this.mExtFOV,
                this.mExtFOVRight,
                this.mExtFOVOverlap,
                this.mExtFOVNormalize,
                this.mExtFOVAverage,
                this.mRingRemoval,
                this.mAngles,
                this.mCenter,
                this.mReconFunc,
                this.mReconParam1,
                this.mScale,
                this.mOverPaddding,
                this.mLogTransform,
                this.mCircle,
                this.mZeroneMode,
                this.mCorrectionOffset,
                this.mDecimateFactor,
                this.mDownscaleFactor,
                this.mPostProcess,
                this.mPostProcessConvertArgs,
                this.mPostProcessCropArgs,
                this.mPhaseRetrieval,
                this.mPhrtMethod,
                this.mParam1,
                this.mParam2,
                this.mDistance,
                this.mEnergy,
                this.mPixelsize,
                this.mPhrtPad,
                Convert.ToInt32(this.nudMultiAngle_From.Value),
                Convert.ToInt32(this.nudMultiAngle_To.Value)
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            int zLines = (Convert.ToInt32(this.nudMultiAngle_To.Value - this.nudMultiAngle_From.Value)) + 1;

            mJobMonitor.Run(zExecuter, this.mSlicePrefix, zLines);
        }
Пример #8
0
        private void runReconstruction(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            mPreProcessOnGoing     = false;
            mPhaseRetrievalOnGoing = false;

            string zOutputPath = Properties.Settings.Default.FormSettings_OutputPath + Path.DirectorySeparatorChar +
                                 Path.GetFileNameWithoutExtension(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf") +
                                 Path.DirectorySeparatorChar + @"slices" + Path.DirectorySeparatorChar;

            if (mAngles_ProjTo == 0)
            {
                mAngles_ProjTo = TDFReader.GetNumberOfProjections(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf") - 1;
            }

            // Create an instance for the reconstruction job:
            zJob = new ReconstructionJob(
                // Get combobox selection (in handler)
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf",
                zOutputPath,
                false,
                mAirSx,
                mAirDx,
                mFlatEnd,
                mHalfHalf,
                mHalfHalfLine,
                mExtFOV,
                mExtFOVRight,
                mExtFOVOverlap,
                mExtFOVNormalize,
                mExtFOVAverage,
                mRingRemoval,

                mAngles,
                mAngles_ProjFrom,
                mAngles_ProjTo,
                mCenter,
                mReconFunc,
                mReconParam1,
                mScale,
                mOverPaddding,
                mLogTransform,
                mCircle,
                mZeroneMode,
                mCorrectionOffset,
                0,
                TDFReader.GetNumberOfSlices(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf") - 1,
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses),
                mDecimateFactor,
                mDownscaleFactor,

                mPostProcess,
                mPostProcessPolarFilt,
                mPostProcessConvertArgs,
                mPostProcessCropArgs,
                mDynamicFlatFielding,

                mRolling,
                mRollShift
                );


            // Create an instance of JobExecuter with the pre processing job:
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job splitting it with several processes (if specified):
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, "slice");

            this.mReconstructionOnGoing = true;

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }
Пример #9
0
 /// <summary>
 /// Stop the monitoring.
 /// </summary>
 /// <param name="jobExecuter">The JobExecutor instance to monitor.</param>
 public void Stop(JobExecuter jobExecuter)
 {
     mJobExecuter = jobExecuter;
 }
Пример #10
0
 /// <summary>
 /// Run the actual monitoring.
 /// </summary>
 /// <param name="jobExecuter">The JobExecutor instance to monitor.</param>
 public void Run(JobExecuter jobExecuter, string strToMonitor)
 {
     mJobExecuter        = jobExecuter;
     mStrToMonitor       = strToMonitor;
     mNrOfLinesToMonitor = 0;
 }
Пример #11
0
        /// <summary>
        /// Activate the monitoring (usually this has to be run by exploiting the BackgroundWorker pattern).
        /// No effects are produced if no JobExecuter instance is associated to the JobMonitor.
        /// </summary>
        public void Start()
        {
            this.mMonitorStarted = true;


            while (mMonitorStarted == true)
            {
                if (mJobExecuter != null)
                {
                    List <string> zFileNameList   = new List <string>();
                    List <int>    zCountList      = new List <int>();
                    List <int>    zLocalCountList = new List <int>();

                    IMonitoredJob zJob = (IMonitoredJob)mJobExecuter.Job;

                    string   zLine;
                    DateTime zT0, zT1;
                    TimeSpan zElapsedTime;
                    //int zProcessedFiles = 0;
                    //int zProcessedLines = 0;
                    bool zFinished = false;



                    // Number of files to process (in order to return the percentage of job completion):
                    int zFilesToProcess;
                    if (mNrOfLinesToMonitor == 0)
                    {
                        zFilesToProcess = zJob.To - zJob.From + 1;
                    }
                    else
                    {
                        zFilesToProcess = mNrOfLinesToMonitor;
                    }


                    StringBuilder aStringBuilder;

                    //
                    // Raise up the the event for the start up of the monitoring:
                    //
                    if (JobStarted != null)
                    {
                        JobStarted(this, new JobEventArgs(Environment.NewLine + "Job for " + zJob.ToString() + " submitted...", 0.0));
                    }

                    try
                    {
                        // Get a first timestamp:
                        zT0 = DateTime.Now;

                        // Create a list of the log files to monitor:
                        for (int i = 0; i < mJobExecuter.Processes; i++)
                        {
                            aStringBuilder = new StringBuilder(zJob.LogFile);
                            aStringBuilder.Remove(zJob.LogFile.Length - 6, 2);
                            aStringBuilder.Insert(zJob.LogFile.Length - 6, i.ToString("00", CultureInfo.InvariantCulture));
                            zFileNameList.Add(aStringBuilder.ToString());
                            zCountList.Add(0);
                            zLocalCountList.Add(0);
                        }

                        // Wait until the files exist:
                        TimeSpan  zTimeOut   = TimeSpan.FromSeconds(Properties.Settings.Default.TimeOutWaitForLogInSeconds);
                        Stopwatch zStopWatch = Stopwatch.StartNew();
                        bool      zDone      = false;

                        while (zStopWatch.Elapsed < zTimeOut && !zDone)
                        {
                            // If all the work is completed set zDone to True:
                            zDone = true;

                            for (int i = 0; i < mJobExecuter.Processes; i++)
                            {
                                string zFileName = (zFileNameList[i]);

                                if (!File.Exists(zFileName))
                                {
                                    zDone = false;
                                }
                            }
                            Thread.Sleep(500);
                        }

                        if (zDone == false)
                        {
                            if (JobError != null)
                            {
                                // Add the time for the execution of the whole job:
                                JobError(this, new JobEventArgs(Environment.NewLine + "Job error: A time out occurred while looking for log files.", 1.0));
                            }
                        }


                        // Start a loop 'till the last file has been processed. Set also a timeout.
                        //while (zProcessedFiles < zFilesToProcess)
                        while (!zFinished)
                        {
                            int zProcessedFiles = 0;

                            // For each file to log:
                            for (int i = 0; i < mJobExecuter.Processes; i++)
                            {
                                string zFileName = zFileNameList[i];
                                zLocalCountList[i] = 0;

                                // Get first the number of lines into this log file:
                                using (FileStream zFileStream = new FileStream(zFileName,
                                                                               FileMode.Open,
                                                                               FileAccess.Read,
                                                                               FileShare.ReadWrite))
                                {
                                    using (StreamReader zStreamReader = new StreamReader(zFileStream))
                                    {
                                        while ((zLine = zStreamReader.ReadLine()) != null)
                                        {
                                            zLocalCountList[i]++;

                                            string zTestString = "\t" + this.mStrToMonitor;
                                            if (zLine.StartsWith(zTestString))
                                            {
                                                zProcessedFiles++;
                                            }
                                        }
                                    }
                                }


                                // Check if the number of lines in this log file is greater than the number of lines read
                                // at the previous step:
                                int zNumberOfLines = zLocalCountList[i];
                                zLocalCountList[i] = 0;
                                if (zNumberOfLines > zCountList[i])
                                {
                                    using (FileStream zFileStream = new FileStream(zFileName,
                                                                                   FileMode.Open,
                                                                                   FileAccess.Read,
                                                                                   FileShare.ReadWrite))
                                    {
                                        using (StreamReader zStreamReader = new StreamReader(zFileStream))
                                        {
                                            while ((zLine = zStreamReader.ReadLine()) != null)
                                            {
                                                // If something to log has been found raise up the event:
                                                if (zLocalCountList[i] >= zCountList[i])
                                                {
                                                    // The number of processed files is determined by reading the log line:

                                                    /*string zTestString = "\t" + this.mStrToMonitor;
                                                     * if (zLine.StartsWith(zTestString))
                                                     * {
                                                     *  // Get processed counter:
                                                     *  string zString = zLine.Substring(zTestString.Length + 1, 4);
                                                     *  int zInt = Convert.ToInt32(zString);
                                                     *  zProcessedFiles = Convert.ToInt32(zLine.Substring(zTestString.Length + 1, 4)) - mJobExecuter.Job.From + 1;
                                                     *  //zProcessedLines++;
                                                     *
                                                     *  // Ending condition:
                                                     *  //if (zLine.StartsWith(zTestString + "_" + mJobExecuter.Job.To.ToString("D4")))
                                                     *  //if ( zProcessedLines >= mNrOfLinesToMonitor )
                                                     *  //    zFinished = true;
                                                     * }*/

                                                    // Raise up the event:
                                                    if (JobStep != null)
                                                    {
                                                        JobStep(this, new JobEventArgs(Environment.NewLine + zLine, zProcessedFiles / ((double)(zFilesToProcess))));
                                                        //JobStep(this, new JobEventArgs(Environment.NewLine + zLine, zProcessedLines / ((double)(mNrOfLinesToMonitor))));
                                                    }
                                                }

                                                // Increment counter:
                                                zLocalCountList[i]++;
                                            }
                                        }
                                    }
                                }
                                zCountList[i] = zNumberOfLines;
                            }

                            // Check ending condition:
                            if (zProcessedFiles >= zFilesToProcess)
                            {
                                zFinished = true;
                            }

                            // Sleep the thread:
                            Thread.Sleep(500);
                        }

                        //
                        // Raise up the the event for completion of the monitoring:
                        //

                        // Get the last timestamp:
                        zT1          = DateTime.Now;
                        zElapsedTime = zT1 - zT0;

                        // Delete logs:
                        for (int i = 0; i < mJobExecuter.Processes; i++)
                        {
                            string zFileName = (zFileNameList[i]);

                            if (File.Exists(zFileName))
                            {
                                File.Delete(zFileName);
                            }
                        }


                        if (JobCompleted != null)
                        {
                            // Add the time for the execution of the whole job:
                            JobCompleted(this, new JobEventArgs(Environment.NewLine + "Job for " + zJob.ToString() + " completed successfully in "
                                                                + zElapsedTime.ToString(@"hh\:mm\:ss") + ".", 1.0));
                        }
                        mJobExecuter = null;
                    }
                    catch (Exception e)
                    {
                        if (JobError != null)
                        {
                            // Add the time for the execution of the whole job:
                            JobError(this, new JobEventArgs(Environment.NewLine + "Job error: " + e.Message + ".", 1.0));
                        }
                        mJobExecuter = null;
                    }
                }

                // Sleep:
                Thread.Sleep(500);
            }
        }