/// <summary>
        /// Creates a document from a source file.
        /// </summary>
        /// <returns>The document.</returns>
        /// <param name="sourceFile">Source file.</param>
        /// <param name="encoding">Encoding.</param>
        public IZptDocument CreateDocument(FileInfo sourceFile, Encoding encoding)
        {
            if(sourceFile == null)
              {
            throw new ArgumentNullException(nameof(sourceFile));
              }

              IZptDocument output;
              var sourceInfo = new SourceFileInfo(sourceFile);

              using(var stream = sourceFile.OpenRead())
              {
            output = this.CreateDocument(stream, sourceInfo, encoding);
              }

              return output;
        }
        /// <summary>
        /// Creates a document from a source file.
        /// </summary>
        /// <returns>The document.</returns>
        /// <param name="sourceFile">Source file.</param>
        /// <param name="encoding">Encoding.</param>
        public IZptDocument CreateDocument(FileInfo sourceFile, Encoding encoding)
        {
            if(sourceFile == null)
              {
            throw new ArgumentNullException(nameof(sourceFile));
              }
              if(encoding == null)
              {
            throw new ArgumentNullException(nameof(encoding));
              }

              var sourceInfo = new SourceFileInfo(sourceFile);

              var doc = new HtmlAgilityPack.HtmlDocument();
              doc.Load(sourceFile.FullName, encoding);

              return CreateDocument(doc, sourceInfo);
        }
Example #3
0
        /// <summary>
        /// Determines whether the specified <see cref="CSF.Zpt.Rendering.SourceFileInfo"/> is equal to the current
        /// <see cref="CSF.Zpt.Rendering.SourceFileInfo"/>.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the specified <see cref="CSF.Zpt.Rendering.SourceFileInfo"/> is equal to the current
        /// <see cref="CSF.Zpt.Rendering.SourceFileInfo"/>; otherwise, <c>false</c>.
        /// </returns>
        /// <param name="obj">
        /// The <see cref="CSF.Zpt.Rendering.SourceFileInfo"/> to compare with the current
        /// <see cref="CSF.Zpt.Rendering.SourceFileInfo"/>.
        /// </param>
        public virtual bool Equals(SourceFileInfo obj)
        {
            bool output;

              if(Object.ReferenceEquals(this, obj))
              {
            output = true;
              }
              else if(obj == null)
              {
            output = false;
              }
              else
              {
            output = obj.FileInfo == this.FileInfo;
              }

              return output;
        }