/// <summary>
        /// Processes the command line options and gets ready to start file
        /// processing.
        /// </summary>
        protected override void StartUp()
        {
            base.StartUp();

            // Initialise the default catalog
            string catalogPath = ConfigurationManager.AppSettings ["HandCoded.FpML Toolkit.XmlCatalog"];

            try {
                XmlUtility.DefaultCatalog = CatalogManager.Find(PathTo(catalogPath));
            }
            catch (Exception error) {
                log.Error("Failed to parse XML catalog", error);
                Environment.Exit(1);
            }
        }
Exemple #2
0
        /// <summary>
        /// Processes the command line options and gets ready to start file
        /// processing.
        /// </summary>
        protected override void StartUp()
        {
            base.StartUp();

            // Initialise the default catalog
            string catalogPath = ConfigurationManager.AppSettings ["HandCoded.FpML Toolkit.XmlCatalog"];

            if (catalogOption.Present)
            {
                if (catalogOption.Value != null)
                {
                    catalogPath = catalogOption.Value;
                }
                else
                {
                    log.Error("Missing argument for -catalog option");
                }
            }

            if (outputOption.Present)
            {
                try {
                    writer = new StreamWriter(outputOption.Value);
                }
                catch (Exception) {
                    log.Error("Failed to create output file");
                    Environment.Exit(1);
                }
            }

            try {
                XmlUtility.DefaultCatalog = CatalogManager.Find(PathTo(catalogPath));
            }
            catch (Exception error) {
                log.Error("Failed to parse XML catalog", error);
                Environment.Exit(1);
            }

            XmlUtility.DefaultSchemaSet.XmlSchemaSet.Compile();
        }
Exemple #3
0
        /// <summary>
        /// Processes the command line options and gets ready to start file
        /// processing.
        /// </summary>
        protected override void StartUp()
        {
            base.StartUp();

            // Initialise the default catalog
            string catalogPath = ConfigurationManager.AppSettings ["HandCoded.FpML Toolkit.XmlCatalog"];

            if (catalogOption.Present)
            {
                if (catalogOption.Value != null)
                {
                    catalogPath = catalogOption.Value;
                }
                else
                {
                    log.Error("Missing argument for -catalog option");
                }
            }

            if (outputOption.Present)
            {
                try {
                    writer = new StreamWriter(outputOption.Value);
                }
                catch (Exception) {
                    log.Error("Failed to create output file");
                    Environment.Exit(1);
                }
            }

            if (repeatOption.Present)
            {
                repeat = Int32.Parse(repeatOption.Value);
                if (repeat <= 0)
                {
                    log.Error("The repeat count must be >= 1");
                    Environment.Exit(1);
                }
            }

            schemaOnly = schemaOnlyOption.Present;
            random     = randomOption.Present;

            if (Arguments.Length == 0)
            {
                log.Error("No files are present on the command line");
                Environment.Exit(1);
            }

            if (reportOption.Present)
            {
                writer.WriteLine("<?xml version=\"1.0\"?>");
                writer.WriteLine("<report>");
            }

            try {
                XmlUtility.DefaultCatalog = CatalogManager.Find(PathTo(catalogPath));
            }
            catch (Exception error) {
                log.Error("Failed to parse XML catalog", error);
                Environment.Exit(1);
            }

            XmlUtility.DefaultSchemaSet.XmlSchemaSet.Compile();
        }