예제 #1
0
        private void ParseReport_INTF(StringReader reader, SpectrumReport report, string[] nuclideList)
        {
            report.Results.Clear();
            string line;

            char[] wspace = new char[] { ' ', '\t' };
            while ((line = reader.ReadLine()) != null)
            {
                line = line.Trim();
                if (line.StartsWith("---INTF---"))
                {
                    return;
                }

                string[] items = line.Split(wspace, StringSplitOptions.RemoveEmptyEntries);
                if (items.Length == 4)
                {
                    if (!nuclideList.Contains(items[0].Trim().ToLower()))
                    {
                        report.Approved       = false;
                        report.ApprovedStatus = "INTF linje ikke funnet i bibliotek";
                        continue;
                    }

                    SpectrumResult result = new SpectrumResult();
                    result.NuclideName         = items[0].Trim();
                    result.Confidence          = Convert.ToDouble(items[1], CultureInfo.InvariantCulture);
                    result.Activity            = Convert.ToDouble(items[2], CultureInfo.InvariantCulture);
                    result.ActivityUncertainty = Convert.ToDouble(items[3], CultureInfo.InvariantCulture);
                    report.Results.Add(result);
                }
            }
        }
예제 #2
0
        private void ParseReport_MDA(StringReader reader, SpectrumReport report, string[] nuclideList)
        {
            string line;

            char[] wspace = new char[] { ' ', '\t' };
            while ((line = reader.ReadLine()) != null)
            {
                line = line.Trim();
                if (line.StartsWith("---MDA---"))
                {
                    return;
                }

                string[] items = line.Split(wspace, StringSplitOptions.RemoveEmptyEntries);
                if (items.Length == 7)
                {
                    string nuclname = items[0].Trim();
                    if (!nuclideList.Contains(nuclname.ToLower()))
                    {
                        report.Approved       = false;
                        report.ApprovedStatus = "MDA linje ikke funnet i bibliotek";
                        continue;
                    }

                    SpectrumResult r = report.Results.Find(x => x.NuclideName == nuclname);
                    if (r != null)
                    {
                        // Resultat finnes, legg til MDA
                        r.MDA = Convert.ToDouble(items[4].Trim(), CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        // Resultat finnes ikke, lag resultat med kun MDA
                        SpectrumResult result = new SpectrumResult();
                        result.NuclideName         = nuclname;
                        result.Confidence          = 0.0;
                        result.Activity            = 0.0;
                        result.ActivityUncertainty = 0.0;
                        result.MDA = Convert.ToDouble(items[4].Trim(), CultureInfo.InvariantCulture);
                        report.Results.Add(result);
                    }
                }
            }
        }