static bool ProcessPublishedJson(Options options) { string dir = Path.Combine(options.FhirDirectory, "publish"); // **** check for this directory existing **** if (!Directory.Exists(dir)) { Console.WriteLine("Publish directory not found!"); return(false); } // **** get all canonical files in the publish directory **** string[] files = Directory.GetFiles(dir, "*.canonical.json", SearchOption.AllDirectories); // **** traverse the files **** foreach (string filename in files) { // **** read the contents **** string contents = File.ReadAllText(filename); // **** act depending on contents **** if (contents.Contains("\"resourceType\":\"StructureDefinition\"")) { // **** check for ignoring these **** if (options.UseOnlyXmlSpreadsheets) { continue; } // **** parse into an object we can work with **** fhir.StructureDefinition sd = JsonConvert.DeserializeObject <fhir.StructureDefinition>(contents); // **** process this structure definition **** ProcessStructureDefinition(sd, filename); // **** done with this file **** continue; } if (contents.Contains("\"resourceType\":\"CodeSystem\"")) { if (options.ExcludeCodeSystems) { continue; } // **** parse into an object we can work with **** fhir.CodeSystem cs = JsonConvert.DeserializeObject <fhir.CodeSystem>(contents); // **** process this code system **** FhirTypeManager.LoadCodeSystem(cs); // **** done with this file **** continue; } if (contents.Contains("\"resourceType\":\"ValueSet\"")) { if (options.ExcludeValueSets) { continue; } // **** parse into an object we can work with **** fhir.ValueSet vs = JsonConvert.DeserializeObject <fhir.ValueSet>(contents); // **** process this value set **** FhirTypeManager.LoadValueSet(vs, filename); // **** done with this file **** continue; } } // **** success ***** return(true); }