コード例 #1
0
        /// <summary>
        /// Processes a single file, using given runner and given file location.
        /// </summary>
        /// <param name="processor">The instance that handles the matrix generation.</param>
        /// <param name="fileLocation">The location of the input file.</param>
        /// <returns>An entry for the matrix table.</returns>
        string ProcessFile(Processor processor, string fileLocation)
        {
            Logger.Info("Processing file " + fileLocation);
            ReportData rd = new ReportData(Logger);

            processor.OutputHandler = delegate(object sender, DataReceivedEventArgs e)
            {
                string data = e.Data;
                Logger.Debug("Received report line: " + data);
                if (!String.IsNullOrEmpty(data) && data.IndexOf(':') > 0)
                {
                    string[] keyval = data.Split(new char[] { ':' }, 2);
                    if (keyval.Length == 2)
                    {
                        rd.setValue(keyval[0], keyval[1]);
                    }
                    else
                    {
                        Logger.Debug("There are not 2 elements in the split data, ignoring");
                    }
                }
            };
            // Run matrix generator
            processor.CallCCExtractor(new TestEntry(fileLocation, "-out=report", ""), "");

            FileInfo f = new FileInfo(fileLocation);

            return(rd.CreateRow(f.Name));
        }