//--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // s e n d R e q u e s t                                              //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Send previously generated request data to target.                  //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static void sendRequest(PJLCommands.eCmdIndex cmdIndx)
        {
            PJLCommands.eRequestType reqType =
                PJLCommands.getType(cmdIndx);

            if ((reqType == PJLCommands.eRequestType.FSDirList) ||
                (reqType == PJLCommands.eRequestType.FSQuery))
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem query; request types:                       //
                //  -   FSDIRLIST                                             //
                //  -   FSQUERY                                               //
                // Response from printer expected.                            //
                //                                                            //
                //------------------------------------------------------------//

                TargetCore.requestStreamWrite(true);
            }
            else if (reqType == PJLCommands.eRequestType.FSUpload)
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem upload to host workstation; request types:  //
                //  -   FSUPLOAD                                              //
                // Response from printer expected - write this direct to the  //
                // target file (it could be (much) larger than standard reply //
                // buffer.                                                    //
                //                                                            //
                //------------------------------------------------------------//

                TargetCore.requestStreamWrite(true);
            }
            else
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem action; request types:                      //
                //  -   FSAPPEND                                              //
                //  -   FSDELETE                                              //
                //  -   FSDOWNLOAD                                            //
                //  -   FSINIT                                                //
                //  -   FSMDKIR                                               //
                // Response from printer not expected.                        //
                //                                                            //
                //------------------------------------------------------------//

                TargetCore.requestStreamWrite(false);
            }
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // r e a d R e s p o n s e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Read response from target.                                         //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static String readResponse(
            PJLCommands.eCmdIndex cmdIndx,
            String binTgtFilenamePJLFS)
        {
            PJLCommands.eRequestType reqType = PJLCommands.getType(cmdIndx);

            if ((reqType == PJLCommands.eRequestType.FSDirList) ||
                (reqType == PJLCommands.eRequestType.FSQuery))
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem query; request types:                       //
                //  -   FSDIRLIST                                             //
                //  -   FSQUERY                                               //
                // Response from printer expected.                            //
                //                                                            //
                //------------------------------------------------------------//

                return(readResponseQuery());
            }
            else if (reqType == PJLCommands.eRequestType.FSUpload)
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem upload; request types:                      //
                //  -   FSUPLOAD                                              //
                //                                                            //
                //------------------------------------------------------------//

                return(readResponseUpload(binTgtFilenamePJLFS));
            }
            else
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem action; request types:                      //
                //  -   FSAPPEND                                              //
                //  -   FSDELETE                                              //
                //  -   FSDOWNLOAD                                            //
                //  -   FSINIT                                                //
                //  -   FSMDKIR                                               //
                // Response from printer not expected.                        //
                //                                                            //
                //------------------------------------------------------------//

                return("No response is expected from the " +
                       PJLCommands.getName(cmdIndx) +
                       " action command");
            }
        }
示例#3
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // r e s e t S t a t i s t i c s                                      //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Reset analysis statisics counts.                                   //
        //                                                                    //
        //--------------------------------------------------------------------//

        public void resetStatistics()
        {
            btnStatistics.IsEnabled   = false;
            txtRptSizeStatistics.Text = "0";

            _tableStatistics.Clear();

            PrescribeCommands.resetStatsCounts();
            PJLCommands.resetStatsCounts();
            PCLComplexSeqs.resetStatsCounts();
            PCLSimpleSeqs.resetStatsCounts();
            PCLControlCodes.resetStatsCounts();
            HPGL2Commands.resetStatsCounts();
            HPGL2ControlCodes.resetStatsCounts();
            PCLXLDataTypes.resetStatsCounts();
            //   PCLXLAttrDefiners.resetStatsCounts ();
            PCLXLAttributes.resetStatsCounts();
            PCLXLAttrEnums.resetStatsCounts();
            //   PCLXLEmbedDataDefs.resetStatsCounts ();
            PCLXLOperators.resetStatsCounts();
            PCLXLWhitespaces.resetStatsCounts();
        }
示例#4
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // b t n S t a t i s t i c s _ C l i c k                              //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Called when the 'Show Statistics' button is clicked.               //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void btnStatistics_Click(object sender, RoutedEventArgs e)
        {
            if (_redoStatistics)
            {
                PrnParseConstants.eOptStatsLevel level =
                    PrnParseConstants.eOptStatsLevel.ReferencedOnly;

                Boolean incUsedSeqsOnly       = false;
                Boolean excUnusedObsPCLSeqs   = false;
                Boolean excUnusedResPCLXLTags = false;

                _options.getOptStats(ref level,
                                     ref excUnusedObsPCLSeqs,
                                     ref excUnusedResPCLXLTags);

                _tableStatistics.Clear();

                if (level ==
                    PrnParseConstants.eOptStatsLevel.ReferencedOnly)
                {
                    incUsedSeqsOnly = true;
                }
                else
                {
                    incUsedSeqsOnly = false;
                }

                PrescribeCommands.displayStatsCounts(_tableStatistics,
                                                     incUsedSeqsOnly);

                PJLCommands.displayStatsCounts(_tableStatistics,
                                               incUsedSeqsOnly);

                PCLControlCodes.displayStatsCounts(_tableStatistics,
                                                   incUsedSeqsOnly);

                PCLSimpleSeqs.displayStatsCounts(_tableStatistics,
                                                 incUsedSeqsOnly,
                                                 excUnusedObsPCLSeqs);

                PCLComplexSeqs.displayStatsCounts(_tableStatistics,
                                                  incUsedSeqsOnly,
                                                  excUnusedObsPCLSeqs);

                HPGL2Commands.displayStatsCounts(_tableStatistics,
                                                 incUsedSeqsOnly);

                HPGL2ControlCodes.displayStatsCounts(_tableStatistics,
                                                     incUsedSeqsOnly);

                PCLXLDataTypes.displayStatsCounts(_tableStatistics,
                                                  incUsedSeqsOnly,
                                                  excUnusedResPCLXLTags);

                PCLXLAttrEnums.displayStatsCounts(_tableStatistics,
                                                  incUsedSeqsOnly,
                                                  excUnusedResPCLXLTags);

                PCLXLAttributes.displayStatsCounts(_tableStatistics,
                                                   incUsedSeqsOnly,
                                                   excUnusedResPCLXLTags);

                PCLXLOperators.displayStatsCounts(_tableStatistics,
                                                  incUsedSeqsOnly,
                                                  excUnusedResPCLXLTags);

                PCLXLWhitespaces.displayStatsCounts(_tableStatistics,
                                                    incUsedSeqsOnly,
                                                    excUnusedResPCLXLTags);

                PMLDataTypes.displayStatsCounts(_tableStatistics,
                                                incUsedSeqsOnly);

                PMLActions.displayStatsCounts(_tableStatistics,
                                              incUsedSeqsOnly);

                PMLOutcomes.displayStatsCounts(_tableStatistics,
                                               incUsedSeqsOnly);

                // TODO = remaining types
                // PCL XL Attribute Definers ??
                // PCL XL Embedded Data Definers ??

                _redoStatistics = false;
            }

            tabCtrl.SelectedItem = tabStatistics;

            /*
             * //----------------------------------------------------------------//
             * //                                                                //
             * // If we ever support the 'doWork' mechanism:                     //
             * //      statusBar updates                                         //
             * //                                                                //
             * //----------------------------------------------------------------//
             *
             * statusBar.Items[2] = dgStatistics.Items.Count;
             * txtRptSizeStatistics.Text = dgStatistics.Items.Count.ToString ();
             */

            txtRptSizeStatistics.Text = _tableStatistics.Rows.Count.ToString();

            btnSaveReport.Content = "Save Statistics Report ...";
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e R e q u e s t                                      //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Generate status readback request data.                             //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static void generateRequest(BinaryWriter prnWriter,
                                           PJLCommands.eCmdIndex cmdIndx,
                                           Int32 indexCategory,
                                           Int32 indexVariable,
                                           String customCat,
                                           String customVar)
        {
            String seq;

            if (cmdIndx != PJLCommands.eCmdIndex.Unknown)
            {
                PJLCommands.eRequestType reqType;

                String cmdName;

                reqType = PJLCommands.getType(cmdIndx);
                cmdName = PJLCommands.getName(cmdIndx);

                if (reqType == PJLCommands.eRequestType.Category)
                {
                    if (indexCategory < PJLCategories.getCount())
                    {
                        if (PJLCategories.getType(indexCategory) ==
                            PJLCategories.eCategoryType.Custom)
                        {
                            seq = "\x1b" + "%-12345X" +
                                  "@PJL ECHO PCLParaphernalia" + "\x0d\x0a" +
                                  "@PJL " +
                                  cmdName + " " +
                                  customCat + "\x0d\x0a" +
                                  "\x1b" + "%-12345X";
                        }
                        else
                        {
                            String categoryName;

                            categoryName = PJLCategories.getName(indexCategory);

                            seq = "\x1b" + "%-12345X" +
                                  "@PJL ECHO PCLParaphernalia" + "\x0d\x0a" +
                                  "@PJL " +
                                  cmdName + " " +
                                  categoryName + "\x0d\x0a" +
                                  "\x1b" + "%-12345X";
                        }

                        prnWriter.Write(seq.ToCharArray(), 0, seq.Length);
                    }
                }
                else
                {
                    if (indexVariable < PJLVariables.getCount())
                    {
                        PJLVariables.eVarType varType;

                        varType = PJLVariables.getType(indexVariable);

                        if (varType == PJLVariables.eVarType.Custom)
                        {
                            seq = "\x1b" + "%-12345X" +
                                  "@PJL ECHO PCLParaphernalia" + "\x0d\x0a" +
                                  "@PJL " +
                                  cmdName + " " +
                                  customVar + "\x0d\x0a" +
                                  "\x1b" + "%-12345X";
                        }
                        else
                        {
                            String variableName;
                            String personality;

                            variableName = PJLVariables.getName(indexVariable);

                            if (varType == PJLVariables.eVarType.PCL)
                            {
                                personality = "LPARM : PCL ";
                            }
                            else if (varType == PJLVariables.eVarType.PDF)
                            {
                                personality = "LPARM : PDF ";
                            }
                            else if (varType == PJLVariables.eVarType.PS)
                            {
                                personality = "LPARM : POSTSCRIPT ";
                            }
                            else
                            {
                                personality = "";
                            }

                            seq = "\x1b" + "%-12345X" +
                                  "@PJL ECHO PCLParaphernalia" + "\x0d\x0a" +
                                  "@PJL " +
                                  cmdName + " " +
                                  personality +
                                  variableName + "\x0d\x0a" +
                                  "\x1b" + "%-12345X";
                        }

                        prnWriter.Write(seq.ToCharArray(), 0, seq.Length);
                    }
                }
            }
        }
示例#6
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // p r o c e s s P J L C o m m a n d                                  //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Process current PJL command in buffer.                             //
        // Command format is one of:                                          //
        //                                                                    //
        //    @PJL [<CR>]<LF>                                                 //
        //                                                                    //
        //    Can be used to separate real commands, and add clarity to long  //
        //    sets of commands.                                               //
        //                                                                    //
        //    @PJL command [<words>] [<CR>}<LF>                               //
        //                                                                    //
        //    For the COMMENT and ECHO commands only.                         //
        //    <words>               Any string of printable characters        //
        //                          (range 0x21-0xff) or whitespace           //
        //                          (space (0x20) or horizontal tab (0x09)),  //
        //                          starting with a printable character.      //
        //                          The string may be enclosed in quote       //
        //                          characters (0x22), in which case it       //
        //                          cannot include a quote character.         //
        //                                                                    //
        //    @PJL command [modifier : value] [option [= value]] [<CR>}<LF>   //
        //                                                                    //
        //    command               One of the defined set of command names.  //
        //    modifier:value        is present for some commands to indicate  //
        //                          particular personality, or port, etc.     //
        //    option                Present for most commands.                //
        //    value                 Associated with 'option' name or (if      //
        //                          that is not present, the command).        //
        //                          There may be more than one option=value   //
        //                          pair.                                     //
        //                                                                    //
        // Whitespace (space or horizontal tab) characters MUST be present    //
        // between the @PJL introducer and the 'command', and between the     //
        // command and modifier names, and between the modifier value and the //
        // option name.                                                       //
        //                                                                    //
        // Interrupt process if an <Esc> character is encountered.            //
        // Long lines are split into shorter slices.                          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private Boolean processPJLCommand(
            ref Int32 bufRem,
            ref Int32 bufOffset,
            ref Boolean continuation,
            ref Boolean langSwitch,
            ref ToolCommonData.ePrintLang crntPDL)
        {
            PrnParseConstants.eContType contType =
                PrnParseConstants.eContType.None;

            Byte crntByte;

            Char crntChar,
                 normChar;

            Int32 len,
                  cmdLen,
                  cmdRem,
                  langLen,
                  offset,
                  lineStart,
                  seqLen = 0;

            Int32 quoteStart = 0,
                  quoteEnd   = 0;

            Boolean invalidSeqFound,
                    endLoop,
                    foundTerm,
                    firstLine;

            Boolean foundStartQuote;
            Boolean seqKnown     = false;
            Boolean noWhitespace = false;

            String lang,
                   commandName,
                   commandParams,
                   line,
                   showChar,
                   desc = "";

            StringBuilder seq = new StringBuilder();

            StringBuilder cmd = new StringBuilder();

            StringBuilder cmdPart1 = new StringBuilder();
            StringBuilder cmdPart2 = new StringBuilder();

            cmdPart1.Append("@PJL");

            invalidSeqFound = false;
            foundStartQuote = false;
            foundTerm       = false;
            firstLine       = true;
            langSwitch      = false;

            lineStart = bufOffset;
            foundTerm = false;

            len    = bufRem;
            offset = bufOffset;

            continuation = false;
            foundTerm    = false;

            cmdRem = bufRem - _lenPJLIntro;
            offset = bufOffset + _lenPJLIntro;
            cmdLen = _lenPJLIntro;

            //----------------------------------------------------------------//
            //                                                                //
            // Search for termination character.                              //
            // This should be a LineFeed (<LF>, 0x0a) character, but may be   //
            // an Escape character (<Esc>, 0x1b) signalling return to PCL.    //
            //                                                                //
            // This is to make sure that the termination character is in the  //
            // buffer before processing the command, so that we don't have to //
            // cater for doing a 'continuation' read part way through         //
            // processing the command.                                        //
            //                                                                //
            // Initiate continuation action if terminator is not found in     //
            // buffer, subject to a maximum command length (to prevent        //
            // recursive continuation actions).                               //
            //                                                                //
            //----------------------------------------------------------------//

            while ((!foundTerm) && (cmdRem > 0) && (cmdLen < _maxPJLCmdLen))
            {
                crntByte = _buf[offset];

                if (crntByte == PrnParseConstants.asciiLF)
                {
                    foundTerm = true;
                    offset++;
                    cmdLen++;
                    cmdRem--;
                }
                else if (crntByte == PrnParseConstants.asciiEsc)
                {
                    foundTerm = true;
                }
                else
                {
                    offset++;
                    cmdLen++;
                    cmdRem--;
                }
            }

            if ((!foundTerm) && (cmdLen != _maxPJLCmdLen))              // ***** Should this be < rather than != ? ***** //
            {
                //------------------------------------------------------------//
                //                                                            //
                // Termination character not found before buffer exhausted,   //
                // or maximum command length exceeded.                        //
                // Initiate (backtracking) continuation action.               //
                //                                                            //
                //------------------------------------------------------------//

                continuation = true;

                contType = PrnParseConstants.eContType.PJL;

                _linkData.setBacktrack(contType, -bufRem);
            }
            else
            {
                //------------------------------------------------------------//
                //                                                            //
                // Process command.                                           //
                // At this point, we have in the buffer one of:               //
                //  - characters terminated by <LF> (counted in length).      //
                //  - characters terminated by <Esc> (not counted in length). //
                //  - characters not terminated, but maxmimum length.         //
                //                                                            //
                //------------------------------------------------------------//

                cmdRem = cmdLen - _lenPJLIntro;
                offset = bufOffset + _lenPJLIntro;

                //------------------------------------------------------------//
                //                                                            //
                // Stage 1: look for & skip past whitespace.                  //
                //                                                            //
                //------------------------------------------------------------//

                endLoop = false;

                while ((!endLoop) && (cmdRem > 0))
                {
                    crntByte = _buf[offset];

                    if ((crntByte == PrnParseConstants.asciiSpace)
                        ||
                        (crntByte == PrnParseConstants.asciiHT))
                    {
                        showChar = PrnParseData.processByte(
                            crntByte,
                            _indxCharSetSubAct,
                            (Byte)_valCharSetSubCode,
                            _indxCharSetName);

                        cmdPart1.Append(showChar);

                        offset++;
                        cmdRem--;
                    }
                    else
                    {
                        endLoop = true;
                    }
                }

                //------------------------------------------------------------//
                //                                                            //
                // Stage 2: look for command name.                            //
                //                                                            //
                //------------------------------------------------------------//

                endLoop = false;

                while ((!endLoop) && (cmdRem > 0))
                {
                    crntByte = _buf[offset];

                    //--------------------------------------------------------//
                    //                                                        //
                    // Check for special characters first.                    //
                    //                                                        //
                    //--------------------------------------------------------//

                    if ((crntByte == PrnParseConstants.asciiSpace)
                        ||
                        (crntByte == PrnParseConstants.asciiHT))
                    {
                        // nextstage = Whitespace;
                        endLoop = true;
                    }
                    else if ((cmdRem == 2) &&
                             (crntByte == PrnParseConstants.asciiCR))

                    {
                        // nextstage = Terminator;
                        endLoop = true;
                    }
                    else if ((cmdRem == 1) &&
                             (crntByte == PrnParseConstants.asciiLF))

                    {
                        // nextstage = Terminator;
                        endLoop = true;
                    }
                    else if (crntByte == PrnParseConstants.asciiEquals)

                    {
                        // nextstage = Part2;
                        endLoop      = true;
                        noWhitespace = true;
                    }
                    else
                    {
                        crntChar = (Char)crntByte;
                        normChar = Char.ToUpper(crntChar);
                        cmd.Append(normChar);

                        showChar = PrnParseData.processByte(
                            crntByte,
                            _indxCharSetSubAct,
                            (Byte)_valCharSetSubCode,
                            _indxCharSetName);

                        cmdPart1.Append(showChar);

                        offset++;
                        cmdRem--;
                    }
                }

                //------------------------------------------------------------//
                //                                                            //
                // Check whether command name known.                          //
                //                                                            //
                //------------------------------------------------------------//

                commandName = cmd.ToString();

                if (commandName == "")
                {
                    seqKnown = PJLCommands.checkCmd(PJLCommands.nullCmdKey,
                                                    ref desc,
                                                    _analysisLevel);
                }
                else
                {
                    seqKnown = PJLCommands.checkCmd(cmd.ToString(),
                                                    ref desc,
                                                    _analysisLevel);
                }

                //------------------------------------------------------------//
                //                                                            //
                // Stage 3: look for command remainder.                       //
                //          TODO : split this up into component parts?        //
                //                                                            //
                //------------------------------------------------------------//

                endLoop = false;

                while ((!endLoop) && (cmdRem > 0))
                {
                    crntByte = _buf[offset];

                    if (crntByte == PrnParseConstants.asciiQuote)
                    {
                        if (!foundStartQuote)
                        {
                            foundStartQuote = true;
                            quoteStart      = offset;
                        }
                        else
                        {
                            quoteEnd = offset;
                        }
                    }

                    crntChar = (Char)crntByte;
                    normChar = Char.ToUpper(crntChar);

                    showChar = PrnParseData.processByte(
                        crntByte,
                        _indxCharSetSubAct,
                        (Byte)_valCharSetSubCode,
                        _indxCharSetName);

                    cmdPart2.Append(showChar);

                    if ((crntByte == PrnParseConstants.asciiSpace)
                        ||
                        (crntByte == PrnParseConstants.asciiHT))
                    {
                    }
                    else if ((crntByte == PrnParseConstants.asciiDEL)
                             ||
                             (crntByte < PrnParseConstants.asciiSpace))
                    {
                        seq.Append((Char)PrnParseConstants.asciiPeriod);
                    }
                    else
                    {
                        seq.Append(normChar);
                    }

                    offset++;
                    cmdRem--;
                }

                //--------------------------------------------------------//
                //                                                        //
                // Stage 4: Output details of sequence.                   //
                //                                                        //
                //--------------------------------------------------------//

                commandParams = cmdPart2.ToString();

                len       = commandParams.Length;
                lineStart = 0;

                while ((firstLine) || (len > 0))
                {
                    if (len > _maxPJLLineLen)
                    {
                        line = commandParams.Substring(lineStart,
                                                       _maxPJLLineLen);
                        len       -= _maxPJLLineLen;
                        lineStart += _maxPJLLineLen;
                    }
                    else
                    {
                        line = commandParams.Substring(lineStart,
                                                       len);
                        len = 0;
                    }

                    if (firstLine)
                    {
                        firstLine = false;

                        if (!seqKnown)
                        {
                            PrnParseCommon.addTextRow(
                                PrnParseRowTypes.eType.MsgWarning,
                                _table,
                                PrnParseConstants.eOvlShow.None,
                                "",
                                "*** Warning ***",
                                "",
                                "Following PJL commmand name not recognised:");
                        }

                        if (noWhitespace)
                        {
                            PrnParseCommon.addTextRow(
                                PrnParseRowTypes.eType.MsgWarning,
                                _table,
                                PrnParseConstants.eOvlShow.None,
                                "",
                                "*** Warning ***",
                                "",
                                "Following PJL command name not terminated" +
                                " by space or tab character:");
                        }

                        PrnParseCommon.addDataRow(
                            PrnParseRowTypes.eType.PJLCommand,
                            _table,
                            PrnParseConstants.eOvlShow.Remove,
                            _indxOffsetFormat,
                            _fileOffset + bufOffset,
                            _analysisLevel,
                            "PJL Command",
                            cmdPart1.ToString(),
                            line);
                    }
                    else
                    {
                        PrnParseCommon.addTextRow(
                            PrnParseRowTypes.eType.PJLCommand,
                            _table,
                            PrnParseConstants.eOvlShow.Remove,
                            "",
                            "",
                            "",
                            line);
                    }
                }

                //--------------------------------------------------------//
                //                                                        //
                // Stage 5: Do any special processing.                    //
                //                                                        //
                //--------------------------------------------------------//

                commandParams = seq.ToString();

                if ((commandName.Length == 5)
                    &&
                    (commandName.Substring(0, 5) == "ENTER")
                    &&
                    (commandParams.Length > 9)
                    &&
                    (commandParams.Substring(0, 9) == "LANGUAGE="))
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Enter Language command encountered.                    //
                    //                                                        //
                    //--------------------------------------------------------//

                    langSwitch = true;

                    seqLen = seq.Length;

                    lang = commandParams.Substring(9, seqLen - 9);

                    langLen = lang.Length;

                    if ((langLen >= 5) &&
                        (lang.Substring(0, 5) == "PCLXL"))
                    {
                        crntPDL = ToolCommonData.ePrintLang.PCLXL;
                    }
                    else if ((langLen >= 7) &&
                             (lang.Substring(0, 7) == "PCL3GUI"))
                    {
                        crntPDL = ToolCommonData.ePrintLang.PCL3GUI;
                    }
                    else if ((langLen >= 3) &&
                             (lang.Substring(0, 3) == "PCL"))
                    {
                        crntPDL = ToolCommonData.ePrintLang.PCL;
                    }
                    else if ((langLen >= 10) &&
                             (lang.Substring(0, 10) == "POSTSCRIPT"))
                    {
                        crntPDL = ToolCommonData.ePrintLang.PostScript;
                    }
                    else if ((langLen >= 4) &&
                             (lang.Substring(0, 4) == "HPGL"))
                    {
                        crntPDL = ToolCommonData.ePrintLang.HPGL2;
                    }
                    else if ((langLen >= 5) &&
                             (lang.Substring(0, 5) == "XL2HB"))
                    {
                        crntPDL = ToolCommonData.ePrintLang.XL2HB;
                    }
                    else
                    {
                        crntPDL = ToolCommonData.ePrintLang.Unknown;
                    }
                }
                else if ((_showPML) &&
                         (((commandName.Length == 5)
                           &&
                           (commandName.Substring(0, 5) == "DMCMD"))
                          ||
                          ((commandName.Length == 6)
                           &&
                           (commandName.Substring(0, 6) == "DMINFO"))))
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // PML Device Management                                  //
                    //                                                        //
                    //--------------------------------------------------------//

                    if ((commandParams.Length > 9)
                        &&
                        (commandParams.Substring(0, 9) == "ASCIIHEX="))
                    {
                        //----------------------------------------------------//
                        //                                                    //
                        // PML sequence; encoded as ASCII HEX.                //
                        // Expected to be enclosed in " quotes and followed   //
                        // by <CR><LF> or <LF> PJL terminator characters.     //
                        // Note that the normalised sequence will have "."    //
                        // characters in place of the <CR> and <LF> control   //
                        // codes.                                             //
                        //                                                    //
                        //----------------------------------------------------//

                        PrnParsePML parsePML = new PrnParsePML();

                        seqLen = quoteEnd - quoteStart - 1;

                        if (seqLen > 0)
                        {
                            invalidSeqFound =
                                parsePML.processPMLASCIIHex(_buf,
                                                            _fileOffset,
                                                            seqLen,
                                                            quoteStart + 1,
                                                            _linkData,
                                                            _options,
                                                            _table);
                        }
                    }
                }

                bufOffset = offset;
                bufRem   -= cmdLen;
            }

            return(invalidSeqFound);
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e R e q u e s t                                      //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Generate file system command data.                                 //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static void generateRequest(BinaryWriter prnWriter,
                                           PJLCommands.eCmdIndex cmdIndx,
                                           Boolean secJob,
                                           String password,
                                           String pathname,
                                           String binSrcFilename,
                                           Int32 option1,
                                           Int32 option2)
        {
            String seq;
            String jobHddr;
            String jobEnd;

            if (cmdIndx != PJLCommands.eCmdIndex.Unknown)
            {
                PJLCommands.eRequestType reqType;

                String cmdName;

                reqType = PJLCommands.getType(cmdIndx);
                cmdName = PJLCommands.getName(cmdIndx);

                if (secJob)
                {
                    jobHddr = "\x1b" + "%-12345X" +
                              "@PJL JOB PASSWORD="******"\x0d\x0a";

                    jobEnd = "\x1b" + "%-12345X";
                }
                else
                {
                    jobHddr = "\x1b" + "%-12345X";

                    jobEnd = "\x1b" + "%-12345X";
                }

                if (reqType == PJLCommands.eRequestType.FSBinSrc)
                {
                    Boolean OK = true;

                    Int64 fileSize = 0;

                    OK = binSrcFileOpen(binSrcFilename, ref fileSize);

                    if (OK)
                    {
                        seq = jobHddr +
                              "@PJL " + cmdName +
                              " FORMAT:BINARY SIZE=" + fileSize.ToString() +
                              " NAME=" + '"' + pathname + '"' +
                              "\x0d\x0a";

                        prnWriter.Write(seq.ToCharArray(), 0, seq.Length);

                        // Read and send content of binSrcFilename

                        binSrcFileCopy(prnWriter);
                        binSrcFileClose();

                        // terminate job with UEL

                        prnWriter.Write(jobEnd.ToCharArray(), 0, jobEnd.Length);
                    }
                }
                else if (reqType == PJLCommands.eRequestType.FSDirList)
                {
                    seq = jobHddr +
                          "@PJL " + cmdName +
                          " NAME=" + '"' + pathname + '"' +
                          " ENTRY=" + option2.ToString() +
                          " COUNT=" + option1.ToString() +
                          "\x0d\x0a" +
                          jobEnd;

                    prnWriter.Write(seq.ToCharArray(), 0, seq.Length);
                }
                else if (reqType == PJLCommands.eRequestType.FSInit)
                {
                    seq = jobHddr +
                          "@PJL " + cmdName +
                          " VOLUME=" + '"' + pathname + '"' +
                          "\x0d\x0a" +
                          jobEnd;

                    prnWriter.Write(seq.ToCharArray(), 0, seq.Length);
                }
                else if (reqType == PJLCommands.eRequestType.FSUpload)
                {
                    seq = jobHddr +
                          "@PJL " +
                          cmdName +
                          " NAME=" + '"' + pathname + '"' +
                          " OFFSET=" + option2.ToString() +
                          " SIZE=" + option1.ToString() +
                          "\x0d\x0a" +
                          jobEnd;

                    prnWriter.Write(seq.ToCharArray(), 0, seq.Length);
                }
                else
                {
                    seq = jobHddr +
                          "@PJL " + cmdName +
                          " NAME=" + '"' + pathname + '"' +
                          "\x0d\x0a" +
                          jobEnd;

                    prnWriter.Write(seq.ToCharArray(), 0, seq.Length);
                }
            }
        }