Beispiel #1
0
        private static void Compare(string resultPath, TextComparisonSettings comparisonSettings)
        {
            string sourcePath = @"GroupDocs.Comparison.Samples.Text.Settings.data.source.txt";
            string targetPath = @"GroupDocs.Comparison.Samples.Text.Settings.data.target.txt";
            // Create to streams of textFiles
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   sourceStream = assembly.GetManifestResourceStream(sourcePath);
            Stream   targetStream = assembly.GetManifestResourceStream(targetPath);
            // Opening two textFiles
            IComparisonTextFile sourcePresentation = new ComparisonTextFile(sourceStream);

            Console.WriteLine("TextFile with source path: " + sourcePath + " was loaded.");
            IComparisonTextFile targetPresentation = new ComparisonTextFile(targetStream);

            Console.WriteLine("TextFile with source path: " + targetPath + " was loaded.");

            // Comparing textFiles
            ITextCompareResult compareResult = sourcePresentation.CompareWith(targetPresentation, comparisonSettings);

            Console.WriteLine("textFiles was compared.");

            // Saving result of comparison to new textFile
            IComparisonTextFile result = compareResult.GetTextFile();
            Stream resultStream        = new FileStream(resultPath, FileMode.Create);

            result.Save(resultStream);
            resultStream.Close();
            Console.WriteLine("Result of comparison was saved to textFile with the folloving source path" +
                              resultPath + ".");
            Console.WriteLine("===============================================");
            Console.WriteLine("");
        }
Beispiel #2
0
        private static void Compare(string sourcePath, string targetPath, string resultPath)
        {
            // Create two streams of presentations
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   sourceStream = assembly.GetManifestResourceStream(sourcePath);
            Stream   targetStream = assembly.GetManifestResourceStream(targetPath);
            // Opening two presentations
            IComparisonTextFile sourcePresentation = new ComparisonTextFile(sourceStream);

            Console.WriteLine("TextFile with source path: " + sourcePath + " was loaded.");
            IComparisonTextFile targetPresentation = new ComparisonTextFile(targetStream);

            Console.WriteLine("TextFile with source path: " + targetPath + " was loaded.");

            // Creating settings for comparison of presentations
            TextComparisonSettings SlidesComparisonSettings = new TextComparisonSettings();

            // Comparing presentations
            ITextCompareResult compareResult = sourcePresentation.CompareWith(targetPresentation, SlidesComparisonSettings);

            Console.WriteLine("Presentations was compared.");

            // Saving result of comparison to new presentation
            IComparisonTextFile result = compareResult.GetTextFile();
            Stream resultStream        = new FileStream(resultPath, FileMode.Create);

            result.Save(resultStream);
            resultStream.Close();
            Console.WriteLine("Result of comparison was saved to TextFile with the following source path" + resultPath + ".");
        }