Ejemplo n.º 1
0
        public void OnExecute()
        {
            if (string.IsNullOrEmpty(NewSet))
            {
                // Reset the filter to be unchanged if we only have a single set so that it will
                // simply output the contents of the set.
                Removed   = Added = false;
                Unchanged = true;
            }

            if (!Added && !Removed && !Changed && !Unchanged)
            {
                // If the user didn't explicitly specify what to include we default to changes only.
                Added = Removed = Changed = true;
            }

            DiffConfigurationOptions options = GetDiffOptions();
            DiffFormat diffFormat            = GetDiffFormat();

            AssemblySet oldAssemblies = AssemblySet.FromPaths(OldSet);
            AssemblySet newAssemblies = AssemblySet.FromPaths(NewSet);

            DiffConfiguration diffConfiguration = new DiffConfiguration(oldAssemblies, newAssemblies, options);

            using (TextWriter output = GetOutput())
                DiffEngine.Export(diffConfiguration, null, diffFormat, output);
        }
Ejemplo n.º 2
0
        public void OnExecute()
        {
            if (string.IsNullOrEmpty(NewSet))
            {
                // Reset the filter to be unchanged if we only have a single set so that it will
                // simply output the contents of the set.
                Removed   = Added = false;
                Unchanged = true;
            }

            if (!Added && !Removed && !Changed && !Unchanged)
            {
                // If the user didn't explicitly specify what to include we default to changes only.
                Added = Removed = Changed = true;
            }

            if (!string.IsNullOrEmpty(Language))
            {
                var cultureInfo = System.Globalization.CultureInfo.GetCultureInfo(Language);
                Thread.CurrentThread.CurrentCulture   = cultureInfo;
                Thread.CurrentThread.CurrentUICulture = cultureInfo;
            }

            DiffConfigurationOptions options = GetDiffOptions();
            DiffFormat diffFormat            = GetDiffFormat();

            AssemblySet oldAssemblies = AssemblySet.FromPaths(OldSetName, OldSet);
            AssemblySet newAssemblies = AssemblySet.FromPaths(NewSetName, NewSet);

            DiffConfiguration diffConfiguration = new DiffConfiguration(oldAssemblies, newAssemblies, options);

            if (diffFormat == DiffFormat.Md)
            {
                DiffDocument diffDocument         = DiffEngine.BuildDiffDocument(diffConfiguration);
                var          markdownDiffExporter = new MarkdownDiffExporter(diffDocument, OutFile, IncludeTableOfContents, CreateFilePerNamespace);
                markdownDiffExporter.Export();
            }
            else
            {
                using (TextWriter output = GetOutput())
                    DiffEngine.Export(diffConfiguration, null, diffFormat, output);
            }
        }
        private static DiffConfiguration UpdateAssemblies(this DiffConfiguration configuration, bool isLeft, IEnumerable <string> newPaths, string newName)
        {
            var assemblySet = AssemblySet.FromPaths(newPaths, newName);

            return(configuration.UpdateAssemblies(isLeft, assemblySet));
        }