Exemplo n.º 1
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>Process the XML spreadsheets in a directory, as described by options.</summary>
        ///
        /// <remarks>Gino Canessa, 12/5/2019.</remarks>
        ///
        /// <param name="options">Options for controlling the operation.</param>
        ///
        /// <returns>True if it succeeds, false if it fails.</returns>
        ///-------------------------------------------------------------------------------------------------

        static bool ProcessXmlSpreadsheetsFor(Options options)
        {
            string dir = Path.Combine(options.FhirDirectory, "source");

            // **** check for this directory existing ****

            if (!Directory.Exists(dir))
            {
                Console.WriteLine("Source directory not found! Skipping XML Spreadsheets");
                return(false);
            }

            // **** build our list of types to include ****

            string[] types = options.TypesForXmlSpreadsheets.Split('|');

            // **** traverse the types we want ****

            foreach (string typeName in types)
            {
                // **** build the filename we expect ****

                string filename = Path.Combine(options.FhirDirectory, "source", typeName, $"{typeName}-spreadsheet.xml");

                // **** check for this file ****

                if (!File.Exists(filename))
                {
                    Console.WriteLine($"Could not find {filename}, will not process XML spreadsheet!");
                    continue;
                }

                // **** remove this type (and subtypes) from the current list ****

                FhirTypeManager.RemoveType(typeName);

                // **** process this file ****

                ProcessResourceXmlFile(filename, false);
            }

            // **** ok ****

            return(true);
        }