Menu

#9 XDir + ReadLines() + large dir listing

open
nobody
None
5
2005-09-09
2005-09-09
Anonymous
No

I ran into a problem where I had a directory that had
about 300 files in it, using XDir (the modifed one i
posted in previous bug report) where most of the way
though the list it would stop because
stream.DataAvailable would be false, but there really is
more data about to come for the list.

So whats happening is ReadLines() thinks its done but
its really not... And if it returns back to Read() it just
checks if messages.count was greater than 0 and
doesnt check again.

I have a clunky thing I was testing but I think its causing
some timeouts in the Read() function, so its not really
ironed out but it works for that large directory case...

Put the following right after the while
(stream.DataAvailable) block in ReadLines()
-------------------------------
if (tmpMes.EndsWith("\n") == false)
{
bool trig = true;
while (trig)
{
Thread.Sleep(100);
trig = false;
while(stream.DataAvailable)
{
trig = true;
bytes = stream.Read
(buffer, 0, buffer.Length);
tmpMes +=
Encoding.ASCII.GetString(buffer, 0, bytes);

    \}
\}

}
-------------------------------

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.