예제 #1
0
            TargetReport Diff(IPackage pkg, SemanticVersion left, SemanticVersion right)
            {
                var creator = new CompareSetCreator();
                var differ  = new CompareSetDiffer();

                var packageDescription = new PackageDescription
                {
                    PackageId = pkg.Id,
                    Versions  = new VersionPair(left.ToString(), right.ToString())
                };

                var compareSets       = creator.Create(packageDescription);
                var diffedCompareSets = differ.Diff(compareSets);
                var vm = ViewModelBuilder.Build(packageDescription, diffedCompareSets);

                foreach (var framework in TopXNugets.Frameworks)
                {
                    var target = vm.targets.FirstOrDefault(trg => trg.Name == framework);
                    if (target != null)
                    {
                        return(target);
                    }
                }

                return(null);
            }
        private string HtmlDiff(string packageName, string fromVersion, string untilVersion)
        {
            using (var writer = new StringWriter())
            {
                var formatter = new APIUpgradeToHtmlFormatter();

                var packageDescription = new PackageDescription
                {
                    PackageId = packageName,
                    Versions = new VersionPair(fromVersion, untilVersion)
                };

                var compareSetCreator = new CompareSetCreator();
                var sets = compareSetCreator.Create(packageDescription);
                var compareSetDiffer = new CompareSetDiffer();
                var diff = compareSetDiffer.Diff(sets);

                formatter.Render(writer, packageDescription, diff);

                return writer.ToString();
            }
        }
        private string HtmlDiff(string packageName, string fromVersion, string untilVersion)
        {
            using (var writer = new StringWriter())
            {
                var formatter = new APIUpgradeToHtmlFormatter();

                var packageDescription = new PackageDescription
                {
                    PackageId = packageName,
                    Versions  = new VersionPair(fromVersion, untilVersion)
                };

                var compareSetCreator = new CompareSetCreator();
                var sets             = compareSetCreator.Create(packageDescription);
                var compareSetDiffer = new CompareSetDiffer();
                var diff             = compareSetDiffer.Diff(sets);

                formatter.Render(writer, packageDescription, diff);

                return(writer.ToString());
            }
        }