Click here to Skip to main content
15,890,690 members
Home / Discussions / C#
   

C#

 
GeneralRe: Regarding the usage of generic in real life Pin
Pete O'Hanlon13-Aug-14 21:46
mvePete O'Hanlon13-Aug-14 21:46 
GeneralRe: Regarding the usage of generic in real life Pin
Pete O'Hanlon12-Aug-14 23:50
mvePete O'Hanlon12-Aug-14 23:50 
QuestionHow to remove escape sequece from string while telnet to HP procurve devices Pin
superselector12-Aug-14 19:17
superselector12-Aug-14 19:17 
AnswerRe: How to remove escape sequece from string while telnet to HP procurve devices Pin
OriginalGriff12-Aug-14 20:57
mveOriginalGriff12-Aug-14 20:57 
AnswerRe: How to remove escape sequece from string while telnet to HP procurve devices Pin
OriginalGriff13-Aug-14 1:25
mveOriginalGriff13-Aug-14 1:25 
GeneralRe: How to remove escape sequece from string while telnet to HP procurve devices Pin
superselector13-Aug-14 22:52
superselector13-Aug-14 22:52 
GeneralRe: How to remove escape sequece from string while telnet to HP procurve devices Pin
OriginalGriff13-Aug-14 23:01
mveOriginalGriff13-Aug-14 23:01 
AnswerRe: How to remove escape sequece from string while telnet to HP procurve devices Pin
Member 1028463313-Aug-14 2:22
Member 1028463313-Aug-14 2:22 
I run into the same problem and have figured out a workaround that works for as. It is not a perfect solution.
I use a regular expressions substituions between the TCP buffer and the Telnet protocol because the firmware sometimes use unknow esc sequnences that bother the telnet/terminal protocol.

I use Perl for switch automation but i try to translate it to C# (The orginal is a Perl module
PERL
Regexp::Common::ANSIescape
).
I use this expression
\x1BE/\n
before the big one and this after
\[[0-9]+;[0-9]+H
because the firmware use sometimes esc secuences that does not exist.

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ProcurevAnsiFilter {
  class Program {
    const string CHAR_STR    = @"(.|\n)*?";

    const string CSI_7BIT    = @"\x1B\\\x5B";
    const string CSI_8BIT    = @"\x9B";

    const string CSI_7OR8    = @"(?:" + CSI_7BIT + "|" + CSI_8BIT + ")";

    const string C1_NST_8BIT = @"[\x80-\x8F\x91-\x97\x99\x9A\x9C]";
    const string C1_NST_7BIT = @"\x1B[\x40-\x4F\x51-\x57\x59\x5A\\\x5C]";

    const string C1_STR_7BIT = @"\x1B[\x5D\x50\x58\x5E\x5F]";
    const string C1_STR_8BIT = @"[\x9D\x90\x98\x9E\x9F]";

    const string C1_STR_7OR8 = @"(?:" + C1_STR_7BIT + "|" + C1_STR_8BIT + ")";

    const string ST_7BIT     = @"\x1B\\\\";
    const string ST_8BIT     = @"\x9C";
    const string ST_7OR8     = @"(?:" + ST_7BIT     + "|" + ST_8BIT     + ")";


    static void Main(string[] args) {
    string[] tmp = new string[] {
      @"(?:[\x30-\x3F]*)(?:[\x20-\x2F]*[\x40-\x7E])",
      C1_NST_7BIT,
      C1_NST_8BIT,
      C1_STR_7OR8 + CHAR_STR + ST_7OR8
    };
      string regex = "(?:" + string.Join("|", tmp) + ")";

      Regex reg = new Regex(regex);
    }
  }
}

QuestionC# Creating Setup Problem Pin
Member 1094435911-Aug-14 23:16
Member 1094435911-Aug-14 23:16 
AnswerRe: C# Creating Setup Problem Pin
Dave Kreskowiak12-Aug-14 2:44
mveDave Kreskowiak12-Aug-14 2:44 
GeneralRe: C# Creating Setup Problem Pin
Member 1094435912-Aug-14 3:50
Member 1094435912-Aug-14 3:50 
GeneralRe: C# Creating Setup Problem Pin
Dave Kreskowiak12-Aug-14 3:54
mveDave Kreskowiak12-Aug-14 3:54 
Questionc#.net Pin
naralasaimanoj11-Aug-14 17:36
naralasaimanoj11-Aug-14 17:36 
AnswerRe: c#.net Pin
Dave Kreskowiak11-Aug-14 18:06
mveDave Kreskowiak11-Aug-14 18:06 
AnswerRe: c#.net Pin
Pete O'Hanlon11-Aug-14 20:14
mvePete O'Hanlon11-Aug-14 20:14 
AnswerRe: c#.net - Use MSI Package installer Pin
Swinkaran11-Aug-14 21:04
professionalSwinkaran11-Aug-14 21:04 
AnswerRe: c#.net Pin
V.12-Aug-14 0:18
professionalV.12-Aug-14 0:18 
GeneralRe: c#.net Pin
OriginalGriff12-Aug-14 0:22
mveOriginalGriff12-Aug-14 0:22 
GeneralRe: c#.net Pin
Richard Deeming12-Aug-14 2:26
mveRichard Deeming12-Aug-14 2:26 
GeneralRe: c#.net Pin
OriginalGriff12-Aug-14 2:32
mveOriginalGriff12-Aug-14 2:32 
QuestionC# Tutor, Sunshine Coast, Qld, Australia. Pin
Kenny__K11-Aug-14 13:43
Kenny__K11-Aug-14 13:43 
AnswerRe: C# Tutor, Sunshine Coast, Qld, Australia. Pin
Kenny__K28-Aug-14 15:14
Kenny__K28-Aug-14 15:14 
AnswerRe: C# Tutor, Sunshine Coast, Qld, Australia. Pin
Thanks787228-Aug-14 19:59
professionalThanks787228-Aug-14 19:59 
QuestionSite not working on IE9 for production server Pin
nitin_ion10-Aug-14 23:03
nitin_ion10-Aug-14 23:03 
SuggestionRe: Site not working on IE9 for production server Pin
Richard MacCutchan11-Aug-14 0:37
mveRichard MacCutchan11-Aug-14 0:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.