private static Resource getResourceFromScannedSource(ResourceStreamScanner.ResourceScanInformation info)
        {
            var    path = info.Origin;
            string artifactXml;

            // Note: no exception handling. If the expected bundled file cannot be
            // read, throw the original exception.
            using (var content = File.OpenRead(path))
            {
                if (content == null)
                {
                    throw new FileNotFoundException("Cannot find file " + path);
                }

                var scanner = new ResourceStreamScanner(content, path);
                var entry   = scanner.FindResourceByUri(info.ResourceUri);

                artifactXml = entry != null?entry.ToString() : null;
            }

            if (artifactXml != null)
            {
                var resultResource = new FhirXmlParser().Parse <Resource>(artifactXml);
                resultResource.AddAnnotation(new OriginInformation {
                    Origin = info.Origin
                });
                return(resultResource);
            }
            else
            {
                return(null);
            }
        }
 private IEnumerable <ResourceStreamScanner.ResourceScanInformation> readInformationFromFile(string path)
 {
     using (var bundleStream = File.OpenRead(path))
     {
         if (bundleStream != null)
         {
             var scanner = new ResourceStreamScanner(bundleStream, path);
             return(scanner.List().ToList());
         }
         else
         {
             return(Enumerable.Empty <ResourceStreamScanner.ResourceScanInformation>());
         }
     }
 }