/// <summary>
        /// Updates changes
        /// </summary>
        /// <param name="changesToUpdate"></param>
        public void UpdateChanges(ChangeInfo[] changesToUpdate)
        {
            //Combine result file name
            resultFileName = name + Guid.NewGuid() + "." + _target.Extention;
            var resultFile = Path.Combine(_settings.RootStoragePath, resultFileName);

            //Updete changes
            comparison.UpdateChanges(changesToUpdate, resultFile);
        }
示例#2
0
        //ExEnd:CompareTextDcumentsFromStreamToFile

        //ExStart:CompareTextDcumentsFromPathToFile
        /// <summary>
        /// Compare two Text documents from file path with saving results into a file
        /// </summary>
        public static void CompareTextDcumentsFromPathToFile()
        {
            // Get instance of GroupDocs.Comparison.Comparison and call method Compare.
            GroupDocs.Comparison.Comparison comparison = Common.getComparison();
            Stream result = comparison.Compare(Path.Combine(Common.sourcePath, Common.sourceFile), Path.Combine(Common.targetPath, Common.targetFile), Path.Combine(Common.resultPath, Common.resultFile), ComparisonType.Text);

            // get changes
            GroupDocs.Comparison.Common.Changes.ChangeInfo[] changeInfo = comparison.GetChanges();

            foreach (GroupDocs.Comparison.Common.Changes.ChangeInfo change in changeInfo)
            {
                Console.WriteLine("Text: " + change.Text);
                // update change with custom text
                change.Text = "Added text by update change.";
            }

            Console.WriteLine("apply changes and display updated stream with changes.");
            // update changes
            result = comparison.UpdateChanges(changeInfo, FileType.Txt);
        }