Esempio n. 1
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>Process the primitive types.</summary>
        ///
        /// <remarks>Gino Canessa, 7/5/2019.</remarks>
        ///
        /// <param name="fhirDirectory">Pathname of the fhir directory.</param>
        ///
        /// <returns>True if it succeeds, false if it fails.</returns>
        ///-------------------------------------------------------------------------------------------------

        static bool ProcessBasePrimitives(string fhirDirectory)
        {
            // **** build the expected path to the primitives.xml file ****

            string primitivesFilename = Path.Combine(fhirDirectory, "source", "datatypes", "primitives.xml");

            Console.WriteLine($"Checking Base Primitives: {primitivesFilename}...");

            // **** make sure the file exists ****

            if (!File.Exists(primitivesFilename))
            {
                Console.WriteLine($"Primitives file: {primitivesFilename} not found!");
                return(false);
            }

            if (!ExcelXmlParser.ParseFile(primitivesFilename, out DataSet ds, true, true))
            {
                Console.WriteLine($"Failed to parse the primitives file: {primitivesFilename}.");

                // **** nothing else to do ****

                return(false);
            }

            // **** process base types from "Imports" sheet ****

            //ProcessPrimitiveTable(ds.Tables["Imports"], Path.GetFileNameWithoutExtension(primitivesFilename));
            ProcessPrimitiveTable(ds.Tables["Imports"], Path.GetFileName(primitivesFilename));

            // **** process base types from "Patterns" sheet ****

            //ProcessPrimitiveTable(ds.Tables["Patterns"], Path.GetFileNameWithoutExtension(primitivesFilename));
            ProcessPrimitiveTable(ds.Tables["Patterns"], Path.GetFileName(primitivesFilename));

            // **** success ****

            return(true);
        }
Esempio n. 2
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>Process the extended primitive file.</summary>
        ///
        /// <remarks>Gino Canessa, 7/8/2019.</remarks>
        ///
        /// <param name="filename">Filename of the file.</param>
        /// <param name="writer">  The writer.</param>
        ///
        /// <returns>True if it succeeds, false if it fails.</returns>
        ///-------------------------------------------------------------------------------------------------

        static bool ProcessResourceXmlFile(string filename, bool isPrimitive)
        {
            // **** make sure the file exists ****

            if (!File.Exists(filename))
            {
                Console.WriteLine($"File: {filename} not found!");
                return(false);
            }

            if (!ExcelXmlParser.ParseFile(filename, out DataSet ds, true, true))
            {
                Console.WriteLine($"Failed to parse the file: {filename}.");

                // **** nothing else to do ****

                return(false);
            }

            string firstElementName = "";

            // **** check to see if this is a type file (may be examples, etc.) ****

            if (ds.Tables.Contains("Data Elements"))
            {
                // **** process the data elements ****

                ProcessDataElementsTable(
                    ds.Tables["Data Elements"],
                    isPrimitive,
                    Path.GetFileName(filename), // Path.GetFileNameWithoutExtension(filename),
                    out firstElementName
                    );
            }

            // **** success ****

            return(true);
        }