F
Finn Stampe Mikkelsen
Hi
I'm trying to track the progress of the stream handling shown in the code
below. I get the correct contentlength (compared to the filesize on the
server), but as
shown below, i need to adjust the pos i report to the progressbar for it to
update correct. Any ideas on why and how i can do it correctly, since i
suspect i'm doing something wrong..
=================
WebRequest requestHtml =
WebRequest.Create("http://www.hamspirit.dk/DaffReport.csv");
WebResponse responseHtml = requestHtml.GetResponse();
StreamReader r = new
StreamReader(responseHtml.GetResponseStream(), Encoding.Default);
StringBuilder htmlContent = new StringBuilder();
pBar1.Maximum = (int)responseHtml.ContentLength;
Count = (int)responseHtml.ContentLength;
Idx = 0;
while (!r.EndOfStream)
{
path = r.ReadLine() + (char)13;
Idx += (path.Length - 1) * 2 + 4;
htmlContent.Append(path);
pBar1.Value = Idx;
}
==============
/Finn
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary and those who
don't.
Es gibt 10 Arten von Menschen. Die, die Binär verstehen, bzw. die, die es
nicht tuhen.
I'm trying to track the progress of the stream handling shown in the code
below. I get the correct contentlength (compared to the filesize on the
server), but as
shown below, i need to adjust the pos i report to the progressbar for it to
update correct. Any ideas on why and how i can do it correctly, since i
suspect i'm doing something wrong..
=================
WebRequest requestHtml =
WebRequest.Create("http://www.hamspirit.dk/DaffReport.csv");
WebResponse responseHtml = requestHtml.GetResponse();
StreamReader r = new
StreamReader(responseHtml.GetResponseStream(), Encoding.Default);
StringBuilder htmlContent = new StringBuilder();
pBar1.Maximum = (int)responseHtml.ContentLength;
Count = (int)responseHtml.ContentLength;
Idx = 0;
while (!r.EndOfStream)
{
path = r.ReadLine() + (char)13;
Idx += (path.Length - 1) * 2 + 4;
htmlContent.Append(path);
pBar1.Value = Idx;
}
==============
/Finn
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary and those who
don't.
Es gibt 10 Arten von Menschen. Die, die Binär verstehen, bzw. die, die es
nicht tuhen.