Ejemplo n.º 1
0
        //========================================================================
        private void CheckerDone(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                session.Disconnect();
                MessageBox.Show("Error Running File\n" + (string)e.Result, "Run Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }

            StatusUpdate(10, "Report Finished\nReading Results");
            int repSeq = session.GetReportSequence(specfile.name, time);

            if (repSeq == -1)
            {
                MessageBox.Show("Couldn't Find Finished Report Sequence!");
                Close();
                return;
            }

            List <SymFile> reports  = new List <SymFile>();
            List <string>  contents = new List <string>();

            reports.Add(new SymFile(session.server, session.sym, repSeq.ToString(), DateTime.Now, 0, SymFile.Type.REPORT));
            string listing = session.FileRead(reports[0]);

            reports[0].sequence = repSeq;
            reports[0].pages    = 1;
            reports[0].title    = "Batch Output for REPWRITER";
            contents.Add(listing.Replace("\n", "\r\n"));

            Regex repReg = new Regex(@"Seq:\s+([0-9]{6})\s+Pages:\s+([0-9]+)\s+Title:\s+([^\n]+)\n");
            Match match  = repReg.Match(listing);

            while (match.Success)
            {
                listing = listing.Replace(match.Value, "");
                SymFile currRep = new SymFile(session.server, session.sym, (int.Parse(match.Groups[1].Value)).ToString(), DateTime.Now, 0, SymFile.Type.REPORT);
                currRep.sequence = int.Parse(match.Groups[1].Value);
                currRep.pages    = int.Parse(match.Groups[2].Value);
                currRep.title    = match.Groups[3].Value;
                reports.Add(currRep);
                contents.Add(session.FileRead(currRep).Replace("\n", "\r\n"));
                //MessageBox.Show('\"' + match.Groups[1].Value + "\"\n\"" + match.Groups[2].Value + "\"\n\"" + match.Groups[3].Value + '\"');
                match = repReg.Match(listing);
            }
            session.Disconnect();

            frmReport viewer = new frmReport(specfile.sym, specfile.name, reports, contents, server, originalInst, false);

            viewer.Show();
            Close();
        }