private static Collection <int> GetAvailableFeatureIdsInternal(ShapeFileFeatureLayer featureLayer) { Collection <int> results = new Collection <int>(); string shxPathFileName = Path.ChangeExtension(featureLayer.ShapePathFilename, ".shx"); ShapeFileIndex shx = null; try { shx = new ShapeFileIndex(shxPathFileName); shx.Open(); var count = shx.GetRecordCount(); for (int i = 1; i <= count; i++) { var contentLength = shx.GetRecordContentLength(i); if (contentLength != 0) { results.Add(i); } } } finally { if (shx != null) { shx.Close(); } } return(results); }
private static Dictionary <int, int> GetRecordContentLengthInternal(ShapeFileFeatureLayer featureLayer, IEnumerable <int> ids) { Dictionary <int, int> results = new Dictionary <int, int>(); string shxPathFileName = Path.ChangeExtension(featureLayer.ShapePathFilename, ".shx"); ShapeFileIndex shx = null; try { shx = new ShapeFileIndex(shxPathFileName); shx.Open(); foreach (var id in ids) { int contentLength = shx.GetRecordContentLength(id); results.Add(id, contentLength); } } finally { if (shx != null) { shx.Close(); } } return(results); }