Пример #1
0
        /// <summary>Initializes this object.</summary>
        /// <exception cref="ArgumentNullException">     Thrown when one or more required arguments are
        ///  null.</exception>
        /// <exception cref="DirectoryNotFoundException">Thrown when the requested directory is not
        ///  present.</exception>
        /// <param name="fhirSpecDirectory">Pathname of the FHIR Spec directory.</param>
        public static void Init(string fhirSpecDirectory)
        {
            // check to make sure we have a directory to work from
            if (string.IsNullOrEmpty(fhirSpecDirectory))
            {
                throw new ArgumentNullException(nameof(fhirSpecDirectory));
            }

            string dir;

            // check for rooted vs relative
            if (Path.IsPathRooted(fhirSpecDirectory))
            {
                dir = fhirSpecDirectory;
            }
            else
            {
                dir = Path.Combine(Directory.GetCurrentDirectory(), fhirSpecDirectory);
            }

            // make sure the directory exists
            if (!Directory.Exists(dir))
            {
                throw new DirectoryNotFoundException($"FHIR Specification Directory not found: {fhirSpecDirectory}");
            }

            // make our instance
            _instance = new FhirManager(dir);
        }
Пример #2
0
        /// <summary>Initializes this object.</summary>
        /// <exception cref="ArgumentNullException">     Thrown when one or more required arguments are
        ///  null.</exception>
        /// <exception cref="DirectoryNotFoundException">Thrown when the requested directory is not
        ///  present.</exception>
        /// <param name="fhirSpecDirectory">        Pathname of the FHIR Spec directory.</param>
        /// <param name="fhirPublishDirectory">Pathname of the FHIR local publish directory.</param>
        public static void Init(string fhirSpecDirectory, string fhirPublishDirectory)
        {
            // check to make sure we have a directory to work from
            if (string.IsNullOrEmpty(fhirSpecDirectory) && string.IsNullOrEmpty(fhirPublishDirectory))
            {
                throw new ArgumentNullException(nameof(fhirSpecDirectory));
            }

            string specDir    = string.Empty;
            string publishDir = string.Empty;

            if (!string.IsNullOrEmpty(fhirSpecDirectory))
            {
                // check for rooted vs relative
                if (Path.IsPathRooted(fhirSpecDirectory))
                {
                    specDir = Path.GetFullPath(fhirSpecDirectory);
                }
                else
                {
                    specDir = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), fhirSpecDirectory));
                }

                // make sure the directory exists
                if (!Directory.Exists(specDir))
                {
                    throw new DirectoryNotFoundException($"FHIR Specification Directory not found: {fhirSpecDirectory}");
                }
            }

            if (!string.IsNullOrEmpty(fhirPublishDirectory))
            {
                // check for rooted vs relative
                if (Path.IsPathRooted(fhirPublishDirectory))
                {
                    publishDir = Path.GetFullPath(fhirPublishDirectory);
                }
                else
                {
                    publishDir = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), fhirPublishDirectory));
                }

                // make sure the directory exists
                if (!Directory.Exists(publishDir))
                {
                    throw new DirectoryNotFoundException($"FHIR Build Directory not found: {fhirPublishDirectory}");
                }
            }

            // make our instance
            _instance = new FhirManager(specDir, publishDir);
        }