private bool _exportSchemaContainer(string path, JMSMLConfigETLConfigSchemaContainer container, bool isFirst)
        {
            // Export the information needed to create a container to hold schemas

            bool firstTime = isFirst;

            using (var w = new StreamWriter(path + "\\" + _schemaListFile, !firstTime))
            {
                if (firstTime)
                {
                    _writeHeaders(w, _schemaHeaders);

                    firstTime = false;
                }

                string line = string.Format("{0}", "SchemaContainer," +
                                            container.Label + "," +
                                            "Mixed" + "," +
                                            '"' + container.LabelAlias + '"' + "," +
                                            '"' + container.Metadata.Label + '"' + "," +
                                            container.Metadata.Thumbnail + "," +
                                            container.Metadata.Tags + "," +
                                            '"' + container.Metadata.Summary + '"' + "," +
                                            '"' + container.Metadata.Description + '"' + "," +
                                            (container.Metadata.Credits != null ? '"' + container.Metadata.Credits + '"' : "") + "," +
                                            '"' + container.Metadata.Use + '"' + "," +
                                            (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.East) : "") + "," +
                                            (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.West) : "") + "," +
                                            (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.North) : "") + "," +
                                            (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.South) : "") + "," +
                                            container.Metadata.MaximumScale + "," +
                                            container.Metadata.MinimumScale + "," +
                                            "");
                w.WriteLine(line);
                w.Flush();
            }

            // Export any domains found in the SchemaContainer

            if (container.Domains != null)
            {
                // Use the coded domain output folder, so these end up in the right location

                path = path + "..\\name_domains_values";
                path = new FileInfo(path).FullName;

                foreach (CodedDomainType codedDomain in container.Domains.CodedDomain)
                {
                    _exportSchemaCodedDomain(path, codedDomain);
                }

                foreach (RangeDomainType rangeDomain in container.Domains.RangeDomain)
                {
                    _exportSchemaRangeDomain(path, rangeDomain);
                }
            }

            return(firstTime);
        }
        public void ExportSchemas(string path)
        {
            // Export each schema as a separate csv file.

            bool   isFirst = true;
            string forPath = new FileInfo(path).FullName;

            JMSMLConfigETLConfigSchemaContainer container = _etlConfig.SchemaContainer;

            JMSMLConfigETLConfigSchemaContainerSchemas[] schemas = container.Schemas;

            // Export the container information

            isFirst = _exportSchemaContainer(forPath, container, isFirst);

            foreach (JMSMLConfigETLConfigSchemaContainerSchemas schemasInstance in schemas)
            {
                // Export the schema set information

                isFirst = _exportSchemaSet(forPath, schemasInstance, isFirst);

                foreach (JMSMLConfigETLConfigSchemaContainerSchemasSchema schema in schemasInstance.Schema)
                {
                    bool isSubtyped = _exportSubtypeSchema(forPath, schema);

                    _exportFieldSchema(forPath, schema, isSubtyped);

                    // Add this schema to the master list of schemas

                    isFirst = _exportSchema(forPath, schema, isFirst);
                }
            }

            // Now test the results against a known set of files

            //_testSchemas(forPath);
        }
        private bool _exportSchemaContainer(string path, JMSMLConfigETLConfigSchemaContainer container, bool isFirst)
        {
            // Export the information needed to create a container to hold schemas

            bool firstTime = isFirst;

            using (var w = new StreamWriter(path + "\\" + _schemaListFile, !firstTime))
            {
                if (firstTime)
                {
                    _writeHeaders(w, _schemaHeaders);

                    firstTime = false;
                }

                string line = string.Format("{0}", "SchemaContainer," +
                                                    container.Label + "," +
                                                    "Mixed" + "," +
                                                    '"' + container.LabelAlias + '"' + "," +
                                                    '"' + container.Metadata.Label + '"' + "," +
                                                    container.Metadata.Thumbnail + "," +
                                                    container.Metadata.Tags + "," +
                                                    '"' + container.Metadata.Summary + '"' + "," +
                                                    '"' + container.Metadata.Description + '"' + "," +
                                                    (container.Metadata.Credits != null ? '"' + container.Metadata.Credits + '"' : "") + "," +
                                                    '"' + container.Metadata.Use + '"' + "," +
                                                    (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.East) : "") + "," +
                                                    (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.West) : "") + "," +
                                                    (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.North) : "") + "," +
                                                    (container.Metadata.Extent != null ? Convert.ToString(container.Metadata.Extent.South) : "") + "," +
                                                    container.Metadata.MaximumScale + "," +
                                                    container.Metadata.MinimumScale + "," +
                                                    "");
                w.WriteLine(line);
                w.Flush();
            }

            // Export any domains found in the SchemaContainer

            if (container.Domains != null)
            {
                // Use the coded domain output folder, so these end up in the right location

                path = path + "..\\name_domains_values";
                path = new FileInfo(path).FullName;

                foreach (CodedDomainType codedDomain in container.Domains.CodedDomain)
                {
                    _exportSchemaCodedDomain(path, codedDomain);
                }

                foreach (RangeDomainType rangeDomain in container.Domains.RangeDomain)
                {
                    _exportSchemaRangeDomain(path, rangeDomain);
                }
            }

            return firstTime;
        }