Exemple #1
0
        public Report ImportReport(TDM api, Stream file)
        {
            cultureInfo = new CultureInfo(parameters["cultureCode"]);

            UUTReport unitTestReport = null;

            using (TextReader reader = new StreamReader(file))
            {
                //Serial #:	Time:   Lot #:  Name	Margin	Unit	Result	Tolerance	Limits
                string   header = reader.ReadLine();
                string   line = reader.ReadLine();
                string   sn = "", measureName = "", xUnit = "", yUnit = "";
                double[] xValues = null;
                while (line != null)
                {
                    if (!string.IsNullOrEmpty(line))
                    {
                        string[] columns = line.Split(new char[] { '\t' });
                        if (columns[0] != "Serial #:")
                        {
                            sn = columns[0];
                        }
                        if (unitTestReport == null || unitTestReport.SerialNumber != sn)
                        {
                            if (unitTestReport != null)
                            {
                                api.Submit(unitTestReport);
                            }
                            unitTestReport = CreateUUTFromHeader(api, columns, sn);
                        }
                        if (columns[0] == "Serial #:")
                        {
                            ReadGraphHeader(unitTestReport, columns, out measureName, out xUnit, out yUnit);
                        }
                        else if (columns.Length > 10)
                        {
                            ReadGraphData(unitTestReport, columns, measureName, xUnit, yUnit, ref xValues);
                        }
                        else
                        {
                            ReadMeasure(unitTestReport, columns);
                        }
                    }
                    line = reader.ReadLine();
                }
                if (unitTestReport != null)
                {
                    api.Submit(unitTestReport);
                }
            }
            return(unitTestReport);
        }
Exemple #2
0
        public Report ImportReport(TDM api, Stream file)
        {
            XDocument infoXml;

            using (ZipFile zipFile = new ZipFile(file))
            {
                ZipEntry zipEntry = zipFile.GetEntry("Info.xml");
                using (Stream zipStream = zipFile.GetInputStream(zipEntry))
                {
                    using (StreamReader streamReader = new StreamReader(zipStream))
                    {
                        infoXml = XDocument.Load(streamReader);
                        int testRuns = int.Parse(infoXml.Element("LogFileInfo").Element("TestRunCount").Value);
                        for (int i = 1; i <= testRuns; i++)
                        {
                            ZipEntry zipEntryRun = zipFile.GetEntry($"Run {i}.xml");
                            using (Stream zipStreamRun = zipFile.GetInputStream(zipEntryRun))
                            {
                                using (StreamReader streamReaderRun = new StreamReader(zipStreamRun))
                                {
                                    XDocument runXML = XDocument.Load(streamReaderRun);
                                    UUTReport uut    = CreateReport(api, runXML);
                                    api.Submit(uut);
                                }
                            }
                        }
                    }
                }
            }
            return(null);
        }