i have the following code ..i need to loop through end of the file as per the commented code shown below how i can do it ?
namespace BVParser
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(@"D:\Jaison\JaisonWorking\EmailParse\Sample.BV.application.Mails\Sample.BV.application.Mails\ToTest\Test\SourceAscii.msg", Encoding.Unicode);
string message = sr.ReadToEnd();
StreamWriter sw = new StreamWriter(@"D:\Jaison\JaisonWorking\EmailParse\Sample.BV.application.Mails\Sample.BV.application.Mails\ToTest\Test\DestAsciiOutNewWOEncodingUnicode.txt");
sw.Write(message);
sw.Close();
sr.Close();
// StreamReader srseek = new StreamReader(@"D:\Jaison\JaisonWorking\EmailParse\Sample.BV.application.Mails\Sample.BV.application.Mails\ToTest\Test\DestAsciiOutNewWOEncodingUnicode6.txt");
FileStream fs = new FileStream(@"D:\Jaison\JaisonWorking\EmailParse\Sample.BV.application.Mails\Sample.BV.application.Mails\ToTest\Test\DestAsciiOutNewWOEncodingUnicode6.txt", FileMode.Open, FileAccess.Read);
StreamReader r = new StreamReader(fs);
int index = message.IndexOf("prod-");
//Label2.Text = index.ToString();
Cluster.Text = message.Substring(index + 5, 2);
int indexend = message.IndexOf(" ", index);
int indexdiff = indexend - index;
Servers.Text = message.Substring(index, indexdiff);
// Loops should start here.. checking indexat("EOF")
While ()
{
int exindex = message.IndexOf("Exception:");
int checkspace = exindex;
checkspace--;
if (checkspace == ' ')
{
exindex = message.IndexOf("Exception:", exindex);
}
int trav = exindex;
while (message[trav] != '.') // || message[trav] != ' '
{
trav--;
}
int expdiff = exindex - trav + 9;
Exceptions.Text = message.Substring(trav, expdiff);
int lastdescindex = message.IndexOf('\n', exindex);
int firstdescindex = exindex + 10;
int diffdesc = lastdescindex - firstdescindex;
Desc.Text = message.Substring(firstdescindex, diffdesc);
// } Loop should end here.
fs.Close();
}
}
}