Ejemplo n.º 1
0
        private void ProcessDetectOption(string sFilePath, DetectContentTypeDelegate detectContentTypeDelegate, 
            Workshare.FCS.Lite.Base.ContentType contentType)
        {
            double dTimeElapsed = 0.0;
            string sTimeElapsed = "";
            bool bUndetected = true;
            string sErrorMessage;

            string sFailureString = "";
            string sPassedFailed;


            int iInstancesFound = DetectContentTypeAndCalculateTime(detectContentTypeDelegate, sFilePath, contentType, out dTimeElapsed, out sErrorMessage);

            m_dAllTestsDetectTime += dTimeElapsed;

            if (m_bDetection)
            {
                sTimeElapsed = dTimeElapsed.ToString();
            }
            if (iInstancesFound == -1)
            {
                sPassedFailed = kFailedFlag;
                bUndetected = false;
                sFailureString = "Error detecting content type";
            }
            else if (iInstancesFound == -2)
            {
                sPassedFailed = kFailedFlag;
                bUndetected = false;
                if (sErrorMessage != "")
                {
                    sFailureString = sErrorMessage;
                }
                else
                {
                    sFailureString = "Error read file";
                }

            }
            else if (iInstancesFound > 0)
            {
                sPassedFailed = kFailedFlag;
                bUndetected = false;
                sFailureString = iInstancesFound.ToString() + " found";
            }
            else
            {
                bUndetected = true;
                sPassedFailed = kPassedFlag;
                sFailureString = "";
            }

            if (!bUndetected)
            {
                sPassedFailed = kFailedFlag;

            }
            else
            {
                sPassedFailed = kPassedFlag;
            }

            m_ResultsDisplay.AddRow(Path.GetFileName(sFilePath), contentType.ToString(), kDetectionOption, sPassedFailed, sFailureString, dTimeElapsed.ToString());
        }
Ejemplo n.º 2
0
        private void FCSProcessFiles(bool bCleaningDetectionOptionsProcess, List<string> listFilesToProcess,
            List<Workshare.FCS.Lite.Base.ContentType> listContentTypesToProcess, DetectContentTypeDelegate detectContentTypeDelegate,
            CleanContentTypeDelegate cleanContentTypeDelegate)
        {
            double dTotalTime = 0.0;
            if (bCleaningDetectionOptionsProcess && listFilesToProcess.Count != 0)
            {
                foreach (string sFilePath in listFilesToProcess)
                {
                    if (m_bCleaning)
                    {
                        ProcessCleanOption(sFilePath, cleanContentTypeDelegate, listContentTypesToProcess);

                        Application.DoEvents();
                    }

                    foreach (Workshare.FCS.Lite.Base.ContentType contentType in listContentTypesToProcess)
                    {
                        ProcessDetectOption(sFilePath, detectContentTypeDelegate, contentType);

                        Application.DoEvents();
                        if (m_bStopProcessing)
                        {
                            return;
                        }
                    }
                }

                if (m_bCleaning)
                {
                    dTotalTime = m_dAllTestsDetectTime + m_dAllTestsCleanTime;

                    m_ResultsDisplay.AddRow("All selected", "All selected", kCleaningOption, "", "", m_dAllTestsCleanTime.ToString());
                    m_ResultsDisplay.AddRow("All selected", "All selected", kCleaningOption + kDetectionOption, "", "", dTotalTime.ToString());
                }

                m_ResultsDisplay.AddRow("All selected", "All selected", kDetectionOption, "", "", m_dAllTestsDetectTime.ToString());


            }
        }
Ejemplo n.º 3
0
        private int DetectContentTypeAndCalculateTime(DetectContentTypeDelegate detectContentTypeDelegate, string sFilePath,
            Workshare.FCS.Lite.Base.ContentType contentType, out double dTimeElapsed, out string sErrorMessage)
        {
            DateTime dtStartTime = DateTime.Now;

            int iContentTypeFound = detectContentTypeDelegate(sFilePath, contentType, out sErrorMessage);

            DateTime dtFinishTime = DateTime.Now;

            System.TimeSpan diffResult = dtFinishTime.Subtract(dtStartTime);
            dTimeElapsed = diffResult.TotalMilliseconds;

            return iContentTypeFound;
        }