Пример #1
0
        public ZipArchiveProblems Validate(ZipArchiveEntry entry)
        {
            if (entry == null) throw new ArgumentNullException(nameof(entry));

            var problems = ZipArchiveProblems.None;

            using (var stream = entry.Open())
            using (var reader = new BinaryReader(stream, _encoding))
            {
                ShapeFileHeader header = null;
                try
                {
                    header = ShapeFileHeader.Read(reader);
                }
                catch (Exception exception)
                {
                    problems += entry.HasShapeHeaderFormatError(exception);
                }

                if (header != null)
                {
                    using (var records = header.CreateShapeRecordEnumerator(reader))
                    {
                        problems += _recordValidator.Validate(entry, records);
                    }
                }
            }

            return problems;
        }