المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Reading multiple binary files as one...



C# Programming
09-15-2009, 10:12 PM
Hi.

I'm writing a program that reads data from binary file and shows it on the screen. There could be a situation that there are multiple data files if the user enables file size limit. If the file size reaches the user-defined limit a new file is created and the data is saved there and so on. So there could be 0.bin, 1.bin, 2.bin, ... and so on.

Naturally I have to read and show the data in this "multiple data file" case, too.

At the moment I have a solution where I create an array of FileStream objects for each file and when I get an end of file I start to read the next stream in the array. This fast and ugly solution but is there any ready-made components/libraries for this kind of data handling or does anyone have a better solution?

The main idea is to show the data as one to the user through a certain file handling class that provides necessary methods like ReadBytes, Seek, etc.

Any hints and tips would be greatly appreciated.

Best regards,

-J-