public DiffDocument(AssemblySet left, AssemblySet right, IEnumerable <DiffLine> lines, IEnumerable <DiffApiDefinition> apiDefinitions) { Left = left; Right = right; Lines = new ReadOnlyCollection <DiffLine>(lines.ToArray()); ApiDefinitions = new ReadOnlyCollection <DiffApiDefinition>(apiDefinitions.ToArray()); }
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); }
public static DiffDocument BuildDiffDocument(DiffConfiguration configuration, CancellationToken cancellationToken) { try { IEnumerable <DiffToken> tokens; IEnumerable <DiffApiDefinition> apiDefinitions; GetTokens(configuration, cancellationToken, out tokens, out apiDefinitions); IEnumerable <DiffLine> lines = GetLines(tokens, cancellationToken); AssemblySet left = configuration.Left; AssemblySet right = configuration.Right; return(new DiffDocument(left, right, lines, apiDefinitions)); } catch (OperationCanceledException) { return(null); } }
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); } }
public static DiffConfiguration UpdateLeftAssemblies(this DiffConfiguration configuration, AssemblySet assemblySet) { return(configuration.UpdateAssemblies(true, assemblySet)); }
private static DiffConfiguration UpdateAssemblies(this DiffConfiguration configuration, bool isLeft, AssemblySet assemblySet) { var isRight = !isLeft; var existingSet = isLeft ? configuration.Left : configuration.Right; // This is the a debatible thing here. // // Without Dipose(), instances of DiffConfiguration would be fully immutable, which means // we could pass it around to different threads and you could be sure that no than is stepping // on your toes. // // However, this also means we would only unlock the files on disk when the GC collects the // the underlying metadata reader host. This means, nobody can open the files exlusively or // deleting them until they are collected. // // A workaround for the user is to simply close the app but I feel the workaround feels really // bad. Especially because most of the assemblies being added to the tool will come from temp // folders on the desktop. // // Since our apps is blocking adding/removing files when an analysis is running, there are // no real advantages of full immutable sharing. existingSet.Dispose(); var newLeft = isLeft ? assemblySet : configuration.Left; var newRight = isRight ? assemblySet : configuration.Right; return(new DiffConfiguration(newLeft, newRight, configuration.Options)); }
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)); }
public static DiffConfiguration UpdateRightAssemblies(this DiffConfiguration configuration, AssemblySet assemblySet) { return(configuration.UpdateAssemblies(false, assemblySet)); }