Example #1
0
        void AddReferences(HashSet <String> referencedFrags,
                           String fragmentDir,
                           StructureDefinition sd)
        {
            const String fcn = "ProcessOne";

            FhirJsonParser parser = new FhirJsonParser();

            foreach (String fragmentUrl in sd.ReferencedFragments())
            {
                String fragmentPath = FragPath(fragmentDir, fragmentUrl.LastUriPart());
                if (File.Exists(fragmentPath) == false)
                {
                    this.ConversionError(this.GetType().Name,
                                         fcn,
                                         $"Missing fragment file {fragmentPath}");
                }
                if (referencedFrags.Contains(fragmentPath) == false)
                {
                    referencedFrags.Add(fragmentPath);
                    StructureDefinition frag = parser.Parse <StructureDefinition>(File.ReadAllText(fragmentPath));
                    this.AddFragment(frag);
                    AddReferences(referencedFrags, fragmentDir, frag);
                }
            }
        }