Exemple #1
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>Process the fhir directory described by options.</summary>
        ///
        /// <remarks>Gino Canessa, 7/15/2019.</remarks>
        ///
        /// <param name="options">Options for controlling the operation.</param>
        ///-------------------------------------------------------------------------------------------------

        static void ProcessFhirDirectory(Options options)
        {
            // **** make sure the directory exists ****

            if (!Directory.Exists(options.FhirDirectory))
            {
                Console.WriteLine($"Specified FHIR directory: {options.FhirDirectory} not found!");
                return;
            }

            // **** delete the output file if it exists ****

            if (File.Exists(options.OutputFile))
            {
                File.Delete(options.OutputFile);
            }

            // **** process all of the json files (only once) ****

            ProcessPublishedJson(options);

            // **** process XML spreadsheets (if necessary) ****

            if (options.UseOnlyXmlSpreadsheets)
            {
                ProcessXmlSpreadsheets(options);
            }

            // **** check for manual spreadsheet overrides ****

            if ((!options.UseOnlyXmlSpreadsheets) &&
                (!string.IsNullOrEmpty(options.TypesForXmlSpreadsheets)))
            {
                ProcessXmlSpreadsheetsFor(options);
            }

            // **** expand value sets ****

            FhirTypeManager.ExpandValueSets();

            // **** trim our output to match requested types ****

            FhirTypeManager.TrimForMatchingNames(options.TypesToOutput);

            // **** do ResourceType checks ****

            while (FhirTypeManager.PerformResourceTypeChecks() != 0)
            {
            }

            // **** check for writing typescript ****

            if (options.LanguageTypeScript)
            {
                WriteTypeScript(options);
            }

            if (options.LanguageCSharpCore)
            {
                WriteCSharp(options, (int)LanguageCSharp.CSharpStyle.SystemTextJson);
            }

            if (options.LanguageCSharpPlain)
            {
                WriteCSharp(options, (int)LanguageCSharp.CSharpStyle.Plain);
            }

            if ((options.LanguageCSharpNewtonsoft) || (options.LanguageCSharpDefault))
            {
                WriteCSharp(options, (int)LanguageCSharp.CSharpStyle.Newtonsoft);
            }

            // **** done ****

            Console.WriteLine("...Done!");
        }