public void Load(string filename) { try { BinaryReaderBE reader = new BinaryReaderBE(File.Open(filename, FileMode.Open)); Load(reader); } catch (Exception) { collectionHeaders = new CollectionHeader[ShapeDescriptor.MaximumCollections]; collections = new Collection[collectionHeaders.Length]; for (int i = 0; i < collectionHeaders.Length; ++i) { collectionHeaders[i] = new CollectionHeader(); collections[i] = new Collection(); } } }
public void Load(BinaryReaderBE reader) { long origin = reader.BaseStream.Position; collectionHeaders = new CollectionHeader[ShapeDescriptor.MaximumCollections]; for (int i = 0; i < collectionHeaders.Length; ++i) { collectionHeaders[i] = new CollectionHeader(); collectionHeaders[i].Load(reader); } collections = new Collection[collectionHeaders.Length]; for (int i = 0; i < collectionHeaders.Length; ++i) { collections[i] = new Collection(); if (collectionHeaders[i].Offset > 0) { reader.BaseStream.Seek(origin + collectionHeaders[i].Offset, SeekOrigin.Begin); collections[i].Load(reader); } } }