Click here to Skip to main content
15,921,989 members
Home / Discussions / C#
   

C#

 
QuestionHow to display Sunday to Saturday format value from database using Gridview Pin
bruze28-Apr-08 4:00
bruze28-Apr-08 4:00 
AnswerRe: How to display Sunday to Saturday format value from database using Gridview Pin
J a a n s28-Apr-08 4:27
professionalJ a a n s28-Apr-08 4:27 
GeneralApplication.Run() Parameter Pin
saneng28-Apr-08 3:07
saneng28-Apr-08 3:07 
GeneralApplication.Run() Pin
saneng28-Apr-08 3:06
saneng28-Apr-08 3:06 
GeneralRe: Application.Run() Pin
Giorgi Dalakishvili28-Apr-08 3:36
mentorGiorgi Dalakishvili28-Apr-08 3:36 
GeneralRe: Application.Run() Pin
Colin Angus Mackay28-Apr-08 4:07
Colin Angus Mackay28-Apr-08 4:07 
GeneralProject post build events Pin
Razvan Dimescu28-Apr-08 2:26
Razvan Dimescu28-Apr-08 2:26 
QuestionText parser Pin
solutionsville28-Apr-08 2:23
solutionsville28-Apr-08 2:23 
I have a routine that takes identifies a specific location on each line of HEX and highlights it. It works fine until it gets to a line that the sniffer did not capture any HEX. From that point on it is highlighting random spots in the file. How should I handle identifing the error, and then continue past it without causing it to randomize the locations?

Here is a sample of what I would normally see in the HEX (all one line);

2008/04/24 19:16:50 [128009]ARES_EINDICATION 010.050.082.101 103.2.01 (19d1) RX 68 bytes 19 D1 26 02 34 E8 AA 20 76 97 51 28 50 76 38 64 49 00 58 02 02 C7 88 01 C7 88 AA 50 76 38 64 49 20 76 97 51 28 D8 07 04 18 13 10 2F 00 00 10 0A 06 0A 06 06 0A 06 0A 06 06 06 06 06 06 06 06 73 74 69 9C F6

Here is a sample of the line with the error in it (all one line);

2008/04/24 19:16:51 [128009]ARES_EINDICATION 010.050.082.104 107.1.01 (1ac1) RX 68 bytes

This is the snippit of the code to find the sequence numbers;

private void findSequenceNumbers()
{
toolStripStatusLabel.Enabled = true;
toolStripStatusLabel.Visible = true;
//Find the ARES and ATCS L3 Sequence Numbers and change to Blue/BOLD color
int lineNum = 0;
bool startingNewLine = true;
FontStyle style = FontStyle.Bold;
string[] lines = rtbDoc.Lines;
string text = rtbDoc.Text;
rtbDoc.Enabled = false;
for (int i = 0; i < text.Length; i++)
{
if (startingNewLine)
{
//Find and highlight ARES EINDICATION Sequence Numbers
if (lines[lineNum].Contains("]ARES_EINDICATION"))
{
i += 154;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Blue;
}
//Find and highlight ARES INDICATION Sequence Number
else if (lines[lineNum].Contains("]ARES_INDICATION"))
{
i += 154;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Blue;
}
//Find and highlight CODELINE INDICATION MESSAGE L3 Sequence Number
else if (lines[lineNum].Contains("]CODELINE_INDICATION_MSG") && lines[lineNum].Contains("RX"))
{
i += 112;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Blue;
}
//Find and highlight CODELINE CONTROL MESSAGE L3 Sequence Number
else if (lines[lineNum].Contains("]CODELINE_CONTROL_MSG"))
{
i += 160;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Blue;
}
//Find and highlight RF L3 ACK L3 Sequence Numbers
else if (lines[lineNum].Contains("]RF_L3_ACK"))
{
i += 109;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Blue;
}
//Find and highlight INT SERV SIG L3 Sequence Numbers
else if (lines[lineNum].Contains("]INT_SERV_SIG"))
{
i += 169;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Yellow;
}
//Find and highlight INT L3 ATCS L3 Sequence Numbers
else if (lines[lineNum].Contains("]INT_L3_ATCS"))
{
i += 112;
rtbDoc.Select(i, 2);
rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style);
rtbDoc.SelectionColor = Color.Blue;
}
else
{
i += lines[lineNum].Length - 1;
}
startingNewLine = false;
Application.DoEvents();
}
if (text[i] == '\n')
{
startingNewLine = true;
lineNum++;
}
}
toolStripStatusLabel.Visible = false;
toolStripStatusLabel.Enabled = false;
rtbDoc.Select(0, 0);
rtbDoc.ScrollToCaret();
rtbDoc.Enabled = true;
rtbDoc.Focus();
}


Thanks,

Brian
GeneralRe: Text parser Pin
carbon_golem28-Apr-08 3:31
carbon_golem28-Apr-08 3:31 
AnswerRe: Text parser Pin
solutionsville28-Apr-08 3:51
solutionsville28-Apr-08 3:51 
GeneralRe: Text parser Pin
carbon_golem28-Apr-08 4:06
carbon_golem28-Apr-08 4:06 
AnswerRe: Text parser Pin
solutionsville28-Apr-08 4:25
solutionsville28-Apr-08 4:25 
GeneralRe: Text parser Pin
carbon_golem28-Apr-08 5:06
carbon_golem28-Apr-08 5:06 
AnswerRe: Text parser Pin
solutionsville28-Apr-08 6:02
solutionsville28-Apr-08 6:02 
AnswerRe: Text parser Pin
solutionsville28-Apr-08 8:02
solutionsville28-Apr-08 8:02 
QuestionGet username of a running process Pin
I'm a member...28-Apr-08 1:55
I'm a member...28-Apr-08 1:55 
GeneralRe: Get username of a running process Pin
Anthony Mushrow28-Apr-08 2:06
professionalAnthony Mushrow28-Apr-08 2:06 
QuestionNeed help with scheduling system Pin
Twyce28-Apr-08 1:39
Twyce28-Apr-08 1:39 
GeneralRe: Need help with scheduling system Pin
Simon P Stevens28-Apr-08 2:01
Simon P Stevens28-Apr-08 2:01 
GeneralRe: Need help with scheduling system Pin
Pete O'Hanlon28-Apr-08 2:05
mvePete O'Hanlon28-Apr-08 2:05 
Questionhow to bind or attach message digest to word document Pin
Sunix.Fu28-Apr-08 1:26
Sunix.Fu28-Apr-08 1:26 
QuestionHow to maintain graphics Pin
baranils28-Apr-08 0:58
baranils28-Apr-08 0:58 
AnswerRe: How to maintain graphics Pin
Pete O'Hanlon28-Apr-08 1:28
mvePete O'Hanlon28-Apr-08 1:28 
GeneralRe: How to maintain graphics Pin
baranils28-Apr-08 1:38
baranils28-Apr-08 1:38 
GeneralNewbie - Unable to cast object of type... Pin
aberbotimue28-Apr-08 0:40
aberbotimue28-Apr-08 0:40 

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.