コード例 #1
0
 public MarkdownDiffExporter(DiffDocument diffDocument, string path, bool includeTableOfContents, bool createFilePerNamespace)
 {
     _diffDocument           = diffDocument;
     _path                   = path;
     _includeTableOfContents = includeTableOfContents;
     _createFilePerNamespace = createFilePerNamespace;
 }
コード例 #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);
            }
        }