/// <summary> /// Create WinDiff like static comparison in Html. /// </summary> /// <param name="sourceXmlFile">the baseline file</param> /// <param name="changedXmlFile">the actual (or target) file</param> /// <param name="fragment">the file is only an Xml fragment</param> /// <param name="options">comparison filtering options</param> /// <param name="reader">Readable output data stream</param> /// <returns>Differences were not found after filtering.</returns> public XmlDiffViewResults DifferencesSideBySideAsHtml( string sourceXmlFile, string changedXmlFile, bool fragment, XmlDiffOptions options) { MemoryStream data = new MemoryStream(); try { this.outputData = new StreamWriter( data, System.Text.Encoding.Unicode); bool identicalData = this.DifferencesSideBySideAsHtml( sourceXmlFile, changedXmlFile, fragment, options, this.outputData); // Move the data to the memory stream this.outputData.Flush(); // Generate the final output using the returned values // from the differences comparison. this.finalOutput = new XmlDiffViewResults(data, identicalData); } finally { if (null != data) { data.Close(); } } // return result of comparison return this.finalOutput; }
/// <summary> /// Write the differences in the Xml data /// as formatted xml-like text return in /// a memory based TextReader object. /// </summary> /// <param name="sourceXmlFile">baseline file</param> /// <param name="changedXmlFile">actual file</param> /// <param name="fragment">This is an xml data frament</param> /// <param name="options">Comparison options</param> /// <param name="reader">A reference to return readable /// formatted xml-like text.</param> /// <returns>data is identical</returns> public XmlDiffViewResults DifferencesAsFormattedText( string sourceXmlFile, string changedXmlFile, bool fragment, XmlDiffOptions options) { MemoryStream data = new MemoryStream(); this.outputData = new StreamWriter( data, System.Text.Encoding.Unicode); bool identicalData; identicalData = this.GetDifferencesAsFormattedText( sourceXmlFile, changedXmlFile, fragment, options); // Move the data to the memory stream this.outputData.Flush(); this.finalOutput = new XmlDiffViewResults(data, identicalData); // return result of comparison return this.finalOutput; }