Down and dirty version?
private bool TestLine(string line)
{
int locRX = line.IndexOf("RX") + 2;
int locBytes = line.IndexOf("bytes");
int byteStringLength = locBytes - locRX;
int byteLength = int.Parse(line.Substring(locRX,
byteStringLength).Trim());
string endOfLine = line.Substring(locBytes + 5).Trim();
string[] bytes = endOfLine.Split(" ".ToCharArray());
if(byteLength == bytes.Length)
return true;
else
return false;
}
I am sure this could be refactored to a much better version. ;-)
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it:
http://gregorybeamer.spaces.live.com/
*************************************************
| Think outside the box!
|
*************************************************
"Brian Cook" <br********@bnsf.comwrote in message
news:26**********************************@microsof t.com...
How do I validate that there are xx number of bytes data after a given
spot.
Here is an example;
2008/04/24 19:16:50 [128009]ARES_EINDICATION 010.050.082.108 117.3.01
(1d61) RX 68 bytes 1D 61 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
19
Where the line reads 68 bytes, I need to validate that all of the 68 bytes
do show up in the line. I would need to do it on each line. When it does
not
equal the value, throw an exception.
Thanks,