File Info Length Property

Feb 3, 2014 at 9:07 PM
Hi,
I'm using Alpha Fs dll to get the file length property for all the files in a folder.
I'm having two delegate methods called at an interval of one min which will access the same set of files.
One method is returning proper file length value while the other method is missing few bytes on some files.
I have tried to get file length by both file info.length and also by opening the file with readwrite share access in file stream.
Once my operation is done i'm disposing the stream.

Can you please suggest any solution?
Developer
Feb 4, 2014 at 6:38 AM
Hi,

Normally the value of the Length property is pre-cached so you
would need to Refresh() it first to get the most current state.

If that doesn't work, might I suggest trying to use the latest development build.

Regards,
Yomodo
Feb 4, 2014 at 10:43 AM
Hi,

I tried that already. That seems to work. But my prob is i want to read the contents of the file.
I'm opening the file in the filestream like below
AlphaFS.FileStream Fs = fi.Open(AlphaFS.FileMode.Open, AlphaFS.FileAccess.Read, AlphaFS.FileShare.ReadWrite);

And i'm writing the data into a byte array until the length of the entire file has been written. The file stream is not fetching the entire data sometimes and is going in indefinite loop.
I'm reading data in chunks. Say 20 MB per loop
Feb 4, 2014 at 10:48 AM
I also have another query. When a file is loaded in stream in read only mode and if i load the same file in stream when it is in use, will it not get the entire data in stream?
Developer
Feb 4, 2014 at 12:37 PM
Hi,

When you use System.IO instead of AlphaFS, everything works for you as expected?

Without code to look at/play with, I'm having a hard time helping you out. Sorry.

Regards,
Yomodo