I have a Silverlight application that is importing Shape files (.shp) and parsing them as streams. A shape file usually also include other companion files that have the same file name other than having a different extension (such as .dbf and .prj).
Because I want to be able to import these file groups directly or from within ZIPs, I wrote some logic to first add all the imported files to a list, then explode any imported zip files' file contents into that same list. When I pass a ZipInputStream to my parsing logic, I get errors and strange behavior that I don't get when I import the files directly. Here's the error I usually get:
System.IO.EndOfStreamException: Attempted to read past the end of the stream.
What am I doing wrong? Why can't I just parse the ZipInputStreams the same way I parse the FileStreams that come from the OpenFileDialog?
NOTE: Sample project is available here. First try importing the sample data files directly (test.shp, test.dbf, test.prj) by multi-selecting them in the OpenFileDialog. Then, try importing the ZIP file (test.zip) which contains the exact same three files and see the error.
Thanks,
J. Tower
Because I want to be able to import these file groups directly or from within ZIPs, I wrote some logic to first add all the imported files to a list, then explode any imported zip files' file contents into that same list. When I pass a ZipInputStream to my parsing logic, I get errors and strange behavior that I don't get when I import the files directly. Here's the error I usually get:
System.IO.EndOfStreamException: Attempted to read past the end of the stream.
What am I doing wrong? Why can't I just parse the ZipInputStreams the same way I parse the FileStreams that come from the OpenFileDialog?
NOTE: Sample project is available here. First try importing the sample data files directly (test.shp, test.dbf, test.prj) by multi-selecting them in the OpenFileDialog. Then, try importing the ZIP file (test.zip) which contains the exact same three files and see the error.
Thanks,
J. Tower