The One Divine
Wanderer
Uncomprehendable C# problem in data output pattern
C# is just needlessly pissing me off, now. What part of:
Could could EVER produce the following:
And STILL tell me my substring call is out of bounds?! Notice that the values are start substringing at 96 and finish at 144, max characters being 186. Out of bounds WHERE?
Most importantly, what +1 incremental for loop could result in two lines of data on the same line when I have two endlines at the end of the string? Simply ludicrous.
C# is just needlessly pissing me off, now. What part of:
Code:
extrarow = (((ASCIIstring.Length % 16 > 0))?(1):(0));
rows = (int)(ASCIIstring.Length / 16) + extrarow;
maxrows = rows;
String tempHexValue;
String tempHexString;
String tempASCIIString;
characters = hexstring.Length;
Console.WriteLine("Total Characters: {0}",characters);
for(int i = 0; i < maxrows; i++)
{
Console.WriteLine("Characters: {0} Rows: {1} Maxrows: {2}", characters, rows, maxrows);
if (characters < 48)
{
Console.WriteLine(hexstring.Substring((3 * 16) * i, characters) + "\n\n");
}
else
{
Console.WriteLine("Start: {0} Finish: {1} Difference: {2}", (3 * 16) * i, (3 * 16) * (i + 1), (3 * 16) * (i + 1) - (3 * 16) * i);
Console.WriteLine(hexstring.Substring((3 * 16) * i, (3 * 16) * (i + 1)) + "\n\n");
characters -= 48;
rows -= 1;
}
}
Could could EVER produce the following:
Code:
Total Characters: 186
Characters: 186 Rows: 4 Maxrows: 4
Start: 0 Finish: 48 Difference: 48
80 77 74 66 00 00 00 00 00 00 00 00 00 00 00 00
Characters: 138 Rows: 3 Maxrows: 4
Start: 48 Finish: 96 Difference: 48
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 64 00 00 00 00 00 00 00 00 00
00 00 00 00 00
Characters: 90 Rows: 2 Maxrows: 4
Start: 96 Finish: 144 Difference: 48
And STILL tell me my substring call is out of bounds?! Notice that the values are start substringing at 96 and finish at 144, max characters being 186. Out of bounds WHERE?
Most importantly, what +1 incremental for loop could result in two lines of data on the same line when I have two endlines at the end of the string? Simply ludicrous.