Exemplo n.º 1
0
        public Diff CreateDiff(AssemblyGroup leftAssemblyGroup, AssemblyGroup rightAssemblyGroup)
        {
            if (rightAssemblyGroup is EmptyAssemblyGroup)
            {
                return(new EmptyDiff());
            }

            return(CreateDiff(ReadTypes(leftAssemblyGroup.Assemblies, leftAssemblyGroup.ReadSymbols), ReadTypes(rightAssemblyGroup.Assemblies, rightAssemblyGroup.ReadSymbols)));
        }
Exemplo n.º 2
0
    static CompareSet CreateCompareSet(string package, VersionPair versions)
    {
        var nugetDownloader = new NuGetDownloader(package, new List<string> { "https://www.nuget.org/api/v2" });

        Console.Out.Write("Preparing {0}-{1}", package, versions);

        var leftAssemblyGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(versions.LeftVersion));
        var rightAssemblyGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(versions.RightVersion));

        Console.Out.WriteLine(" done");

        return new CompareSet
        {
            Name = package,
            RightAssemblyGroup = rightAssemblyGroup,
            LeftAssemblyGroup = leftAssemblyGroup,
            Versions = versions
        };
    }
Exemplo n.º 3
0
    private static CompareSet GetExplicitAssembliesToCompare(string[] args)
    {
        var sourceIndex = Array.FindIndex(args, arg => arg == "--source");

        if (sourceIndex < 0)
        {
            throw new Exception("No target assemblies specified, please use --source {asm1};{asm2}...");
        }

        var targetIndex = Array.FindIndex(args, arg => arg == "--target");

        if (targetIndex < 0)
        {
            throw new Exception("No target assemblies specified, please use --target {asm1};{asm2}...");
        }

        var source = args[sourceIndex + 1];

        AssemblyGroup leftAsmGroup;

        string leftVersion;

        var compareName = "Custom";

        if (source.StartsWith("nuget:"))
        {

            var nugetName = source.Replace("nuget:", "").Trim();

            compareName = nugetName;

            var feeds = GetFeedsToUse(args);

            var nugetBrowser = new NuGetBrowser(feeds);

            var version = nugetBrowser.GetAllVersions(nugetName,args.Contains("--include-prerelease")).Max();

            var nugetDownloader = new NuGetDownloader(nugetName, feeds);

            leftVersion = version.ToString();

            leftAsmGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(leftVersion));
        }
        else
        {
            leftVersion = "TBD-Left";

            leftAsmGroup = new AssemblyGroup(source.Split(';').Select(Path.GetFullPath).ToList());
        }

        return new CompareSet
        {
            Name = compareName,
            RightAssemblyGroup = new AssemblyGroup(args[targetIndex + 1].Split(';').Select(Path.GetFullPath).ToList()),
            LeftAssemblyGroup = leftAsmGroup,
            Versions = new VersionPair(leftVersion, "TBD-Right")

        };
    }