public XmlExporter(Document document, ExportSettings settings, ExportConfigFile config, IFileSystem fileSystem)
     : base(document, settings, config, fileSystem)
 {
     this.outputSettings             = new XmlWriterSettings();
     this.outputSettings.Indent      = true;
     this.outputSettings.IndentChars = "\t";
 }
Example #2
0
        private void ExportToOutputMethod(export.ExportSettings settings, Document document, Configuration.Output output)
        {
            DateTime start = DateTime.Now;
            DateTime end;

            export.ExportConfigFile config = new export.ExportConfigFile(
                Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                + "\\ApplicationData\\"
                + output.File
                );
            config.Initialise();

            _log.LogProgress($"\nExporting with {output.File} to location {output.Location}.\n");

            if (!config.IsValid)
            {
                _log.LogError($"There are issues with the LDEC file: {output.File}\n");
            }
            else
            {
                settings.PublishDirectory = output.Location;

                export.Exporter exporter = export.Exporter.Create(document, settings, config);
                exporter.ExportStep       += new export.ExportStepEventHandler(exporter_ExportStep);
                exporter.ExportException  += new export.ExportExceptionHandler(exporter_ExportException);
                exporter.ExportCalculated += new export.ExportCalculatedEventHandler(exporter_ExportCalculated);
                exporter.ExportFailed     += new export.ExportFailedEventHandler(exporter_ExportFailed);

                List <export.Issue> issues = exporter.GetIssues();
                if (issues.Count > 0)
                {
                    foreach (export.Issue issue in issues)
                    {
                        _log.LogError($"{issue.Description}\n");
                    }
                }
                else
                {
                    _log.LogInformation($"The export began at {start}.\n");
                    exporter.Export();
                    end = DateTime.Now;

                    if (exporter.ExportExceptions != null && exporter.ExportExceptions.Count > 0)
                    {
                        _log.LogWarning("The export completed with the following issues:\n");
                        foreach (Exception current in exporter.ExportExceptions)
                        {
                            _log.LogWarning(FormatExceptionData(current));
                        }
                    }

                    _log.LogInformation($"The export completed at {end}, taking {end.Subtract(start).ToString()}.\n");
                }
            }
        }
Example #3
0
        /// <summary>
        /// Initialises a new instance of the HtmlHelp1Exporter.
        /// </summary>
        /// <param name="document">The document to be exported.</param>
        /// <param name="config">The export config file, from the LDEC container.</param>
        public HtmlHelp1Exporter(Document document, ExportSettings settings, ExportConfigFile config)
            : base(document, settings, config, new FileSystem())
        {
            string regex = string.Format("{0}{1}",
                                         new string(Path.GetInvalidFileNameChars()),
                                         new string(Path.GetInvalidPathChars()));

            illegalFileCharacters = new System.Text.RegularExpressions.Regex(
                string.Format("[{0}]", System.Text.RegularExpressions.Regex.Escape(regex))
                );
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Exporter"/> class.
        /// </summary>
        protected Exporter(Document document, ExportSettings settings, ExportConfigFile config, IFileSystem fileSystem)
        {
            _fileSystem = fileSystem;

            _config           = config;
            _settings         = settings;
            _document         = document;
            _exportExceptions = new List <Exception>();

            string regex = string.Format("{0}{1}",
                                         new string(Path.GetInvalidFileNameChars()),
                                         new string(Path.GetInvalidPathChars()));

            _illegalFileCharacters = new System.Text.RegularExpressions.Regex(
                string.Format("[{0}]", System.Text.RegularExpressions.Regex.Escape(regex))
                );
        }
Example #5
0
        /// <summary>
        /// Factory method for creating new Exporter instances.
        /// </summary>
        /// <include file='../code-documentation/exporter.xml' path='docs/exporter[@name="Create"]'/>
        public static Exporter Create(Document document, ExportSettings settings, ExportConfigFile config)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            Exporter createdExporter = null;

            switch (config.Exporter)
            {
            case Exporters.Html1:
                createdExporter = new HtmlHelp1Exporter(document, settings, config);
                break;

            case Exporters.Html2:
                createdExporter = new HtmlHelp2Exporter(document, settings, config);
                break;

            case Exporters.HelpViewer1:
                createdExporter = new HelpViewer1Exporter(document, settings, config);
                break;

            case Exporters.XML:
                createdExporter = new XmlExporter(document, settings, config);
                break;

            case Exporters.Website:
            default:
                createdExporter = new WebsiteExporter(document, settings, config);
                break;
            }

            return(createdExporter);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WebsiteExporter"/> class.
 /// </summary>
 /// <param name="document">The document to be exported.</param>
 /// <param name="config">The export configuration.</param>
 public WebsiteExporter(Document document, ExportSettings settings, ExportConfigFile config)
     : base(document, settings, config, new FileSystem())
 {
 }
Example #7
0
 /// <summary>
 /// Initialises a new instance of the HelpViewer1Exporter class.
 /// </summary>
 /// <param name="document">The document to export.</param>
 /// <param name="config">The export configuration.</param>
 public HelpViewer1Exporter(Document document, ExportSettings settings, ExportConfigFile config)
     : base(document, settings, config, new FileSystem())
 {
 }