Ejemplo n.º 1
0
        public void StartAnalyze(StreamReader fileStream, string fileName)
        {
            AnalyzeThreadParameters parameters = new AnalyzeThreadParameters();

            parameters.filename = fileName;
            parameters.stream   = fileStream;

            // wait until a thread is available and then queue the work
            this.threadSemaphore.WaitOne();

            ThreadPool.QueueUserWorkItem(new WaitCallback(AnalyzeFilestream), parameters);
        }
Ejemplo n.º 2
0
        private void AnalyzeFilestream(object context)
        {
            AnalyzeThreadParameters parameters = (AnalyzeThreadParameters)context;

            try
            {
                FileAnalyzer analyzer =
                    new FileAnalyzer(parameters.stream, this.listener, null, this.configFile.SuppressMethodSignatures,
                                     parameters.filename, this.configFile.SwitchStatementBehavior);

                analyzer.Analyze();
                parameters.stream.Close(); // free up the stream.
            }
            catch (UnknownStructureException error)
            {
                lock (this.mutex)
                {
                    this.errors.Add(new ErrorInfo(parameters.filename, error.Message));
                }
            }
            catch (PreprocessorException)
            {
                lock (this.mutex)
                {
                    this.errors.Add(new ErrorInfo(parameters.filename, "Error running pre-processor. Only basic support for #ifdefs."));
                }
            }
            catch (Exception)
            {
                lock (this.mutex)
                {
                    this.errors.Add(new ErrorInfo(parameters.filename, "Unknown error parsing file."));
                }
            }

            this.threadSemaphore.Release();
        }
Ejemplo n.º 3
0
        public void StartAnalyze(StreamReader fileStream, string fileName)
        {
            AnalyzeThreadParameters parameters = new AnalyzeThreadParameters();
              parameters.filename = fileName;
              parameters.stream = fileStream;

              // wait until a thread is available and then queue the work
              this.threadSemaphore.WaitOne();

              ThreadPool.QueueUserWorkItem(new WaitCallback(AnalyzeFilestream), parameters);
        }