Exemple #1
0
        public Response sendCmdWithResponseText(string var)
        {
            Response resp       = new Response();
            String   tempString = "";

            try
            {
                objSession.Send(var);
                //tempString = objSession.get_LastResponse().get_Buffer();
                resp.FullText = tempString;

                for (int ctr = 0, ctr2 = 1; ctr < tempString.Length; ctr += 80, ctr2++)
                {
                    try
                    {
                        ResponsePerLine line = new ResponsePerLine();
                        line.LineNumber = ctr2;
                        line.Text       = tempString.Substring(ctr, 80);
                        resp.Texts.Add(line);
                    }
                    catch
                    {
                        ResponsePerLine             line = new ResponsePerLine();
                        line.LineNumber = ctr2; int y = 1;
                        if (tempString.Contains(")>"))
                        {
                            y = 2;
                        }
                        line.Text = tempString.Substring(ctr, y);
                        resp.Texts.Add(line);
                    }
                }
            }
            catch (Exception ex)
            {
                _errorStr = ex.Message;
            }


            resp.NumberOfLines = resp.Texts.Count;
            return(resp);
        }
Exemple #2
0
        public Response GetLastFullReponse()
        {
            Response resp       = new Response();
            String   tempString = "";

            tempString    = objSession.LastResponse.Buffer;
            resp.FullText = tempString;
            for (int ctr = 0, ctr2 = 1; ctr < tempString.Length; ctr += 80, ctr2++)
            {
                try
                {
                    ResponsePerLine line = new ResponsePerLine();
                    line.LineNumber = ctr2;
                    line.Text       = tempString.Substring(ctr, 80);
                    resp.Texts.Add(line);
                }
                catch
                {
                    ResponsePerLine             line = new ResponsePerLine();
                    line.LineNumber = ctr2; int y = 1;
                    if (tempString.Contains(")>"))
                    {
                        ctr = 0;
                        objSession.Send("md");
                        tempString     = objSession.LastResponse.Buffer;
                        resp.FullText += tempString;
                        line.Text      = tempString.Substring(ctr, 80);
                    }
                    else
                    {
                        line.Text = tempString.Substring(ctr, y);
                    }

                    resp.Texts.Add(line);
                }
            }
            resp.NumberOfLines = resp.Texts.Count;
            return(resp);
        }