Beispiel #1
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e t R o w C o l o u r S t y l e D a t a                          //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Get references to colour style data for colour coded analysis.     //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void getRowColourStyleData(
            PrnParseOptions options,
            ref String[] classes,
            ref String[] clrBack,
            ref String[] clrFore)
        {
            Int32 indxClrBack;
            Int32 indxClrFore;

            PropertyInfo[] stdClrsPropertyInfo = null;

            Boolean flagClrMapUseClr = false;

            PropertyInfo pInfoBack,
                         pInfoFore;

            Int32 ctClrMapRowTypes = PrnParseRowTypes.getCount();
            Int32 ctClrMapStdClrs  = 0;

            Int32[] indxClrMapBack = new Int32[ctClrMapRowTypes];
            Int32[] indxClrMapFore = new Int32[ctClrMapRowTypes];

            options.getOptClrMap(ref flagClrMapUseClr,
                                 ref indxClrMapBack,
                                 ref indxClrMapFore);

            options.getOptClrMapStdClrs(ref ctClrMapStdClrs,
                                        ref stdClrsPropertyInfo);

            //----------------------------------------------------------------//

            for (Int32 i = 0; i < ctClrMapRowTypes; i++)
            {
                String rowType =
                    Enum.GetName(typeof(PrnParseRowTypes.eType), i);

                indxClrBack = indxClrMapBack[i];
                indxClrFore = indxClrMapFore[i];

                pInfoBack = stdClrsPropertyInfo[indxClrBack] as PropertyInfo;
                pInfoFore = stdClrsPropertyInfo[indxClrFore] as PropertyInfo;

                classes[i] = rowType;
                clrBack[i] = pInfoBack.Name;
                clrFore[i] = pInfoFore.Name;
            }
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // i n i t i a l i s e                                                //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Initialise 'target' data.                                          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void initialise()
        {
            //----------------------------------------------------------------//
            //                                                                //
            // Populate form.                                                 //
            //                                                                //
            //----------------------------------------------------------------//

            btnGenerate.Content = "Generate overlay";

            _options = new PrnParseOptions();  // need a dummy one //

            grpOverlay.Visibility  = Visibility.Hidden;
            grpProgress.Visibility = Visibility.Hidden;

            btnGenerate.Visibility   = Visibility.Hidden;
            btnSaveReport.Visibility = Visibility.Hidden;

            //----------------------------------------------------------------//
            //                                                                //
            // Reinstate settings from persistent storage.                    //
            //                                                                //
            //----------------------------------------------------------------//

            metricsLoad();

            txtPrnFilename.Text = _prnFilename;

            txtPCLMacroId.Text      = _macroIdPCL.ToString();
            txtPCLXLStreamName.Text = _streamNamePCLXL;

            rbPCLOvlEnc.IsChecked   = _flagOvlEncPCL;
            rbPCLXLOvlEnc.IsChecked = _flagOvlEncPCLXL;

            chkPCLRestoreCursor.IsChecked = _flagRestoreCursorPCL;
            chkPCLXLRestoreGS.IsChecked   = _flagRestoreGSPCLXL;

            if (_flagOvlEncPCL)
            {
                lbPCLMacroId.Visibility  = Visibility.Visible;
                txtPCLMacroId.Visibility = Visibility.Visible;
            }
            else
            {
                lbPCLMacroId.Visibility  = Visibility.Hidden;
                txtPCLMacroId.Visibility = Visibility.Hidden;
            }

            if (_flagOvlEncPCLXL)
            {
                lbPCLXLStreamName.Visibility  = Visibility.Visible;
                txtPCLXLStreamName.Visibility = Visibility.Visible;
            }
            else
            {
                lbPCLXLStreamName.Visibility  = Visibility.Hidden;
                txtPCLXLStreamName.Visibility = Visibility.Hidden;
            }

            //----------------------------------------------------------------//

            txtPCLOvlFilename.Text   = _ovlFilenamePCL;
            txtPCLXLOvlFilename.Text = _ovlFilenamePCLXL;

            //----------------------------------------------------------------//

            Int32 ctRowTypes = PrnParseRowTypes.getCount();

            _indxClrMapBack = new Int32[ctRowTypes];
            _indxClrMapFore = new Int32[ctRowTypes];

            _options.getOptClrMap(ref _flagClrMapUseClr,
                                  ref _indxClrMapBack,
                                  ref _indxClrMapFore);

            _options.getOptClrMapStdClrs(ref _ctClrMapStdClrs,
                                         ref _stdClrsPropertyInfo);

            //----------------------------------------------------------------//

            initialiseGridProgress();
        }
Beispiel #3
0
        //--------------------------------------------------------------------//
        //                                                        F i e l d s //
        // Class variables.                                                   //
        //                                                                    //
        //--------------------------------------------------------------------//

        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e                                                    //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Generate the report.                                               //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static void generate(
            ToolPrnAnalyse.eInfoType indxInfoType,
            ReportCore.eRptFileFmt rptFileFmt,
            DataTable table,
            String prnFilename,
            Int64 fileSize,
            Boolean flagOffsetHex,
            PrnParseOptions options)
        {
            Object stream = null;
            Object writer = null;

            Boolean OK = false;

            Int32 reportSize;

            String fileExt;
            String saveFilename = null;

            if (rptFileFmt == ReportCore.eRptFileFmt.html)
            {
                fileExt = "html";
            }
            else if (rptFileFmt == ReportCore.eRptFileFmt.xml)
            {
                fileExt = "xml";
            }
            else
            {
                fileExt = "txt";
            }

            if (indxInfoType == ToolPrnAnalyse.eInfoType.Analysis)
            {
                saveFilename = prnFilename + "_analysis." + fileExt;

                OK = ReportCore.docOpen(rptFileFmt,
                                        ref saveFilename,
                                        ref stream,
                                        ref writer);

                if (OK)
                {
                    Int32 ctClrMapRowTypes = PrnParseRowTypes.getCount();

                    Boolean useClr = options.FlagClrMapUseClr;

                    reportSize = table.Rows.Count;

                    if (useClr)
                    {
                        String[] rowClasses = new String[ctClrMapRowTypes];
                        String[] rowClrBack = new String[ctClrMapRowTypes];
                        String[] rowClrFore = new String[ctClrMapRowTypes];

                        getRowColourStyleData(options,
                                              ref rowClasses,
                                              ref rowClrBack,
                                              ref rowClrFore);

                        ReportCore.docInitialise(rptFileFmt, writer, true, false,
                                                 ctClrMapRowTypes, rowClasses,
                                                 rowClrBack, rowClrFore);
                    }
                    else
                    {
                        ReportCore.docInitialise(rptFileFmt, writer, true, false,
                                                 0, null,
                                                 null, null);
                    }

                    reportHeader(indxInfoType, rptFileFmt, writer,
                                 prnFilename, fileSize, reportSize);

                    reportBodyAnalysis(rptFileFmt, writer,
                                       table, flagOffsetHex);

                    ReportCore.docFinalise(rptFileFmt, writer);

                    ReportCore.docClose(rptFileFmt, stream, writer);
                }
            }
            else if (indxInfoType == ToolPrnAnalyse.eInfoType.Content)
            {
                saveFilename = prnFilename + "_content." + fileExt;

                OK = ReportCore.docOpen(rptFileFmt,
                                        ref saveFilename,
                                        ref stream,
                                        ref writer);
                if (OK)
                {
                    reportSize = table.Rows.Count;

                    ReportCore.docInitialise(rptFileFmt, writer, true, false,
                                             0, null,
                                             null, null);

                    reportHeader(indxInfoType, rptFileFmt, writer,
                                 prnFilename, fileSize, reportSize);

                    reportBodyContent(rptFileFmt, writer,
                                      table, flagOffsetHex);

                    ReportCore.docFinalise(rptFileFmt, writer);

                    ReportCore.docClose(rptFileFmt, stream, writer);
                }
            }
            else if (indxInfoType == ToolPrnAnalyse.eInfoType.Statistics)
            {
                saveFilename = prnFilename + "_statistics." + fileExt;

                OK = ReportCore.docOpen(rptFileFmt,
                                        ref saveFilename,
                                        ref stream,
                                        ref writer);
                if (OK)
                {
                    reportSize = table.Rows.Count;

                    ReportCore.docInitialise(rptFileFmt, writer, true, false,
                                             0, null,
                                             null, null);

                    reportHeader(indxInfoType, rptFileFmt, writer,
                                 prnFilename, fileSize, reportSize);

                    reportBodyStatistics(rptFileFmt, writer,
                                         table);

                    ReportCore.docFinalise(rptFileFmt, writer);

                    ReportCore.docClose(rptFileFmt, stream, writer);
                }
            }
        }
Beispiel #4
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // i n i t i a l i s e                                                //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Initialise . . .                                                   //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void initialise()
        {
            //    _initialised = false;

            _redoAnalysis   = true;
            _redoContent    = true;
            _redoStatistics = true;

            //----------------------------------------------------------------//
            //                                                                //
            // Populate form.                                                 //
            //                                                                //
            //----------------------------------------------------------------//

            btnAnalysis.IsEnabled   = false;
            btnContent.IsEnabled    = false;
            btnStatistics.IsEnabled = false;
            btnSaveReport.IsEnabled = false;

            //----------------------------------------------------------------//

            //     btnAnalyse.Content = "Analyse print file";

            //----------------------------------------------------------------//
            //                                                                //
            //                                                                //
            //                                                                //
            //----------------------------------------------------------------//

            _options = new PrnParseOptions();

            /*
             * //----------------------------------------------------------------//
             * //                                                                //
             * // If we ever support the 'doWork' mechanism:                     //
             * //                                                                //
             * //----------------------------------------------------------------//
             *
             * _bkWk = new BackgroundWorker ();
             *
             * _bkWk.WorkerReportsProgress = true;
             *
             * _bkWk.DoWork += new DoWorkEventHandler (this.bkWk_DoWork);
             *
             * _bkWk.RunWorkerCompleted +=
             *  new RunWorkerCompletedEventHandler (this.bkWk_Completed);
             *
             * _bkWk.ProgressChanged +=
             *  new ProgressChangedEventHandler (this.bkWk_Progress);
             */

            //----------------------------------------------------------------//
            //                                                                //
            // Reinstate settings from persistent storage.                    //
            //                                                                //
            //----------------------------------------------------------------//

            metricsLoad();

            _fileSize = -1;

            Int32 ctRowTypes = PrnParseRowTypes.getCount();

            _indxClrMapBack = new Int32[ctRowTypes];
            _indxClrMapFore = new Int32[ctRowTypes];

            _options.getOptClrMap(ref _flagClrMapUseClr,
                                  ref _indxClrMapBack,
                                  ref _indxClrMapFore);

            _options.getOptClrMapStdClrs(ref _ctClrMapStdClrs,
                                         ref _stdClrsPropertyInfo);

            /*
             * //----------------------------------------------------------------//
             * //                                                                //
             * // If we ever support the 'doWork' mechanism:                     //
             * //      statusBar updates                                         //
             * //                                                                //
             * //----------------------------------------------------------------//
             *
             * statusBar.Items[0] = "";
             * statusBar.Items[1] = "";
             */

            txtFileName.Text = "";
            txtFileSize.Text = "";

            //----------------------------------------------------------------//

            initialiseGridAnalysis();
            initialiseGridContent();
            initialiseGridStatistics();

            //----------------------------------------------------------------//

            //     _initialised = true;
        }
Beispiel #5
0
        //--------------------------------------------------------------------//
        //                                                        F i e l d s //
        // Class variables.                                                   //
        //                                                                    //
        //--------------------------------------------------------------------//

        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e                                                    //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Generate the report.                                               //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static void generate(
            ReportCore.eRptFileFmt rptFileFmt,
            DataTable table,
            String prnFilename,
            String ovlFilename,
            Boolean flagOffsetHex,
            PrnParseOptions options)
        {
            Object stream = null;
            Object writer = null;

            Boolean OK = false;

            String fileExt;
            String saveFilename = null;

            if (rptFileFmt == ReportCore.eRptFileFmt.html)
            {
                fileExt = "html";
            }
            else if (rptFileFmt == ReportCore.eRptFileFmt.xml)
            {
                fileExt = "xml";
            }
            else
            {
                fileExt = "txt";
            }

            saveFilename = ovlFilename + "_report." + fileExt;

            OK = ReportCore.docOpen(rptFileFmt,
                                    ref saveFilename,
                                    ref stream,
                                    ref writer);

            if (OK)
            {
                Int32 ctClrMapRowTypes = PrnParseRowTypes.getCount();

                Boolean useClr = options.FlagClrMapUseClr;

                if (useClr)
                {
                    String[] rowClasses = new String[ctClrMapRowTypes];
                    String[] rowClrBack = new String[ctClrMapRowTypes];
                    String[] rowClrFore = new String[ctClrMapRowTypes];

                    getRowColourStyleData(options,
                                          ref rowClasses,
                                          ref rowClrBack,
                                          ref rowClrFore);

                    ReportCore.docInitialise(rptFileFmt, writer, true, false,
                                             ctClrMapRowTypes, rowClasses,
                                             rowClrBack, rowClrFore);
                }
                else
                {
                    ReportCore.docInitialise(rptFileFmt, writer, true, false,
                                             0, null,
                                             null, null);
                }

                reportHeader(rptFileFmt, writer,
                             prnFilename, ovlFilename);

                reportBody(rptFileFmt, writer,
                           table, flagOffsetHex);

                ReportCore.docFinalise(rptFileFmt, writer);

                ReportCore.docClose(rptFileFmt, stream, writer);
            }
        }