Example #1
0
        private void AssociateInputFilesWithCrashItemSources()
        {
            CACmdLineFSEntityList <CACmdLineFileSource> sourceFileNames = iInputs.SourceFiles;
            CIEngineSourceCollection sources = iEngine.CrashItemEngine.Sources;
            int count = sources.Count;

            // Emit progress banner
            iProgressReporter.StepBegin("Categorizing files...", KStepKeyCategorizingInputFiles, count);

            // Check each source in the engine and try to map it back onto an input source
            // file name. The goal is to identify input files which have no corresponding crash engine
            // source. These files are unsupported.
            for (int i = 0; i < count; i++)
            {
                CIEngineSource source         = sources[i];
                string         sourceFileName = source.FileName;

                // Try to match an input file with a given source object
                CACmdLineFileSource inputFile = sourceFileNames[sourceFileName];
                if (inputFile != null)
                {
                    inputFile.Source = source;
                }

                // Report progress as we work through the sources
                iProgressReporter.StepProgress(string.Empty, i, KStepKeyCategorizingInputFiles);
            }

            iProgressReporter.StepEnd(string.Empty, KStepKeyCategorizingInputFiles);
        }
        private void CrashItemEngine_SourceObserver(CIEngine.TSourceEvent aEvent, CIEngineSource aSource, object aParameter)
        {
            if (iReportProgress)
            {
                string msg = string.Empty;
                //
                switch (aEvent)
                {
                case CIEngine.TSourceEvent.EEventSourceReady:
                    msg = string.Format("Reading file: [{0}], progress: 100%", aSource.FileName);
                    break;

                case CIEngine.TSourceEvent.EEventSourceProgress:
                    if (aParameter != null && aParameter is int)
                    {
                        msg = string.Format("Reading file: [{0}], progress: {1:d3}%", aSource.FileName, (int)aParameter);
                    }
                    break;

                default:
                    break;
                }

                // Output a message only if we have one
                if (string.IsNullOrEmpty(msg) == false)
                {
                    Print(msg);
                }
            }
        }
Example #3
0
        private void CrashItemEngine_SourceObserver(CIEngine.TSourceEvent aEvent, CIEngineSource aSource, object aParameter)
        {
            string msg = string.Empty;

            //
            switch (aEvent)
            {
            case CIEngine.TSourceEvent.EEventSourceStateChanged:
                if (aSource.State == CIEngineSource.TState.EStateProcessing)
                {
                    iProgressReporter.StepBegin("Processing crash file: " + aSource.FileName, aSource.FileName, 100);
                }
                break;

            case CIEngine.TSourceEvent.EEventSourceReady:
                iProgressReporter.StepEnd(string.Empty, aSource.FileName);
                break;

            case CIEngine.TSourceEvent.EEventSourceProgress:
                if (aParameter != null && aParameter is int)
                {
                    iProgressReporter.StepProgress(string.Empty, (int)aParameter, aSource.FileName);
                }
                break;

            default:
                break;
            }
        }
Example #4
0
        internal void OnSourceProgress(CIEngineSource aSource, int aProgress)
        {
            this.Trace("[CIEngine] OnSourceProgress() - START - aSource: {0}, aSource.IsReady: {1}, aProgress: {2}", aSource.FileName, aSource.IsReady, aProgress);

            SourceObservers(TSourceEvent.EEventSourceProgress, aSource, aProgress);

            this.Trace("[CIEngine] OnSourceProgress() - END - aSource: {0}, aSource.IsReady: {1}, aProgress: {2}", aSource.FileName, aSource.IsReady, aProgress);
        }
Example #5
0
        internal void OnSourceStateChanged(CIEngineSource aSource)
        {
            this.Trace("[CIEngine] OnSourceStateChanged() - START - aSource: {0}, aSource.IsReady: {1}, aSource.State: {2}", aSource.FileName, aSource.IsReady, aSource.State);

            SourceObservers(TSourceEvent.EEventSourceStateChanged, aSource, null);
            if (aSource.IsReady)
            {
                SourceObservers(TSourceEvent.EEventSourceReady, aSource, null);
            }

            this.Trace("[CIEngine] OnSourceStateChanged() - END - aSource: {0}, aSource.IsReady: {1}, aSource.State: {2}", aSource.FileName, aSource.IsReady, aSource.State);
        }
        private void AssociateInputFilesWithCrashItemSources()
        {
            CACmdLineFSEntityList <CACmdLineFileSource> sourceFileNames = iInputs.SourceFiles;

            // Emit progress banner
            if (iReportProgress)
            {
                Print("Categorizing files...");
            }

            // Check each source in the engine and try to map it back onto an input source
            // file name. The goal is to identify input files which have no corresponding crash engine
            // source. These files are unsupported.
            CIEngineSourceCollection sources = iCrashItemEngine.Sources;
            int count    = sources.Count;
            int progress = -1;

            for (int i = 0; i < count; i++)
            {
                CIEngineSource source         = sources[i];
                string         sourceFileName = source.FileName;

                // Try to match an input file with a given source object
                CACmdLineFileSource inputFile = sourceFileNames[sourceFileName];
                if (inputFile != null)
                {
                    inputFile.Source = source;
                }

                // Report progress as we work through the sources
                if (iReportProgress)
                {
                    float newProgress = (((float)i + 1) / (float)count) * 100.0f;
                    if ((int)newProgress != progress || i == count - 1)
                    {
                        progress = (int)newProgress;
                        Print(string.Format("{0:d3}%", progress));
                    }
                }
            }
        }
        public void Rationalise()
        {
            // At this point we're ready to decide how we will process the source
            // files. Some may be trace files, in which case we probably need to multiple
            // the various plugin handlers (that support trace-based content) so that they
            // can each have a stab at handling the trace content.
            //
            // For native (non-trace) handlers, we only let the handler with the highest
            // confidence ultimately read the file.
            //
            // 1) For any native entries, sort them by priority and discard
            //    everything but the highest priority entry.
            //
            // 2) For any trace entries, then we basically don't need to do anything
            //    because all entries will require processing via a trace reader.
            foreach (KeyValuePair <FileInfo, List <CFFSourceAndConfidence> > kvp in iEntries)
            {
                // For native entries relating to this file
                List <CFFSourceAndConfidence> listNative = new List <CFFSourceAndConfidence>();

                // For trace entries relating to this file
                List <CFFSourceAndConfidence> listTrace = new List <CFFSourceAndConfidence>();

                FileInfo file = kvp.Key;
                List <CFFSourceAndConfidence> entries = kvp.Value;
                foreach (CFFSourceAndConfidence conf in entries)
                {
                    if (conf.OpType == CFFSource.TReaderOperationType.EReaderOpTypeNative)
                    {
                        listNative.Add(conf);
                    }
                    else if (conf.OpType == CFFSource.TReaderOperationType.EReaderOpTypeTrace)
                    {
                        listTrace.Add(conf);
                    }
                    else
                    {
                        // Not supported
                    }
                }

                // Sort the native list based upon confidence level
                Comparison <CFFSourceAndConfidence> comparer = delegate(CFFSourceAndConfidence aLeft, CFFSourceAndConfidence aRight)
                {
                    return(aLeft.CompareTo(aRight));
                };
                listNative.Sort(comparer);

                // Save highest priority native entry - only try to treat the source file as a
                // trace entry if no native entries claim to be able to read it.
                if (listNative.Count > 0)
                {
                    CFFSourceAndConfidence highestConfidence = listNative[0];
                    CIEngineSource         sourceNative      = CIEngineSource.NewNative(iEngine, highestConfidence);
                    iEngine.Sources.Add(sourceNative);
                }
                else if (listTrace.Count > 0)
                {
                    // If we found some trace entries, then immediately store the trace source.
                    // The listTrace array contains all of the plugins that claim to be able to
                    // read the trace-based source file.
                    CIEngineSource sourceTrace = CIEngineSource.NewTrace(iEngine, listTrace.ToArray());
                    iEngine.Sources.Add(sourceTrace);
                }
            }
        }
Example #8
0
 protected CIEngineSourceReader(CIEngineSource aSource)
 {
     iSource = aSource;
 }
        private void TryToIdentifyCrashes()
        {
            Exception crashEngineException = null;

            //
            try
            {
                iCrashItemEngine.SourceObservers += new CIEngine.CIEngineSourceObserver(CrashItemEngine_SourceObserver);
                iCrashItemEngine.IdentifyCrashes(TSynchronicity.ESynchronous);
            }
            catch (Exception exception)
            {
                crashEngineException = exception;
            }
            finally
            {
                iCrashItemEngine.SourceObservers -= new CIEngine.CIEngineSourceObserver(CrashItemEngine_SourceObserver);
            }

            // Check each source in the engine and create messages based upon it's
            // state at the end of processing.
            foreach (CACmdLineFileSource file in iInputs.SourceFiles)
            {
                if (file.Source != null)
                {
                    CIEngineSource source = file.Source;
                    switch (source.State)
                    {
                    case CIEngineSource.TState.EStateReady:
                        // Success case - the source resulted in the creation of at least one container
                        file.AddDiagnostic("Source Read Successfully", string.Format("{0} crash container(s) created", source.ContainerCount));
                        break;

                    case CIEngineSource.TState.EStateReadyNoItems:
                        file.AddWarning("Source File Contains No Crashes", "The input data was read successfully but contains no crash information.");
                        break;

                    case CIEngineSource.TState.EStateReadyCorrupt:
                        file.AddError("Source File is Corrupt", "The input data is invalid or corrupt.");
                        break;

                    case CIEngineSource.TState.EStateUninitialised:
                        file.AddError("Source File not Read", "The input data was never read.");
                        file.AddDiagnostic("Source State Invalid", "Source is still in unitialised state, even though reading is complete?");
                        break;

                    case CIEngineSource.TState.EStateProcessing:
                        file.AddDiagnostic("Source State Invalid", "Source is still in processing state, even though reading is complete?");
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    file.AddError("File is Not Supported", "There file type is not recognized and was not processed.");
                }

                // Add in details of any exception
                if (crashEngineException != null)
                {
                    file.AddDiagnostic("Crash Identification Exception Message", crashEngineException.Message);
                    file.AddDiagnostic("Crash Identification Exception Stack", crashEngineException.StackTrace);
                }
            }
        }
Example #10
0
 public CIEngineSourceReaderTrace(CIEngineSource aSource, CFFSource[] aPluginSources)
     : base(aSource)
 {
     iPluginSources.AddRange(aPluginSources);
 }
 public CIEngineSourceReaderNative(CIEngineSource aSource, CFFSource aPluginSource)
     : base(aSource)
 {
     iPluginSource = aPluginSource;
 }