Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Analyser"/> class.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="secondPhaseType">Type of the second phase.</param>
        /// <param name="memoryModelType">Type of the memory model.</param>
        public Analyser(string fileName, SecondPhaseType secondPhaseType, MemoryModelType memoryModelType)
        {
            this.FileName        = fileName;
            this.SecondPhaseType = secondPhaseType;
            this.MemoryModelType = memoryModelType;

            IsFinished = false;
            EndState   = AnalysisEndState.NotFinished;

            State = AnalysisState.Initialising;
            clearComputation();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Shows the start analysis dialog and starts the analysis when user accepts the dialog.
        /// </summary>
        /// <returns>Returns true when analysis was started</returns>
        private bool showStartAnalysisDialog()
        {
            StartAnalysisWindow startAnalysisWindow = new StartAnalysisWindow()
            {
                FileName            = fileName,
                MemoryModelType     = memoryModelType,
                SecondPhaseType     = secondPhaseType,
                NumberOfRepetitions = numberOfRepetions,
                IsBenchmarkEnabled  = isBenchmarkEnabled
            };

            if (startAnalysisWindow.ShowStartAnalysisDialog() == true)
            {
                fileName           = startAnalysisWindow.FileName;
                memoryModelType    = startAnalysisWindow.MemoryModelType;
                secondPhaseType    = startAnalysisWindow.SecondPhaseType;
                numberOfRepetions  = startAnalysisWindow.NumberOfRepetitions;
                isBenchmarkEnabled = startAnalysisWindow.IsBenchmarkEnabled;
                memoryLimit        = startAnalysisWindow.MemoryLimit;

                if (isBenchmarkEnabled)
                {
                    phaseHead.Visibility         = System.Windows.Visibility.Collapsed;
                    phaseText.Visibility         = System.Windows.Visibility.Collapsed;
                    repetitionHead.Visibility    = System.Windows.Visibility.Visible;
                    repetitionText.Visibility    = System.Windows.Visibility.Visible;
                    numOfWarningsHead.Visibility = System.Windows.Visibility.Collapsed;
                    numOfWarningsText.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    phaseHead.Visibility         = System.Windows.Visibility.Visible;
                    phaseText.Visibility         = System.Windows.Visibility.Visible;
                    repetitionHead.Visibility    = System.Windows.Visibility.Collapsed;
                    repetitionText.Visibility    = System.Windows.Visibility.Collapsed;
                    numOfWarningsHead.Visibility = System.Windows.Visibility.Visible;
                    numOfWarningsText.Visibility = System.Windows.Visibility.Visible;
                }

                Title = string.Format("Weverca PHP analyzer - [{0}]", fileName);
                startAnalysis();

                return(true);
            }
            else
            {
                return(false);
            }
        }