Ejemplo n.º 1
0
            public override Symbol VisitAssembly(AssemblySymbol symbol)
            {
                if (symbol.IsLinked)
                {
                    return(symbol);
                }

                // the current source assembly:
                if (symbol.Identity.Equals(_sourceAssembly.Identity))
                {
                    return(_otherAssembly);
                }

                // find a referenced assembly with the exactly same source identity:
                foreach (var otherReferencedAssembly in _otherAssembly.Modules[0].ReferencedAssemblySymbols)
                {
                    var identity      = symbol.Identity;
                    var otherIdentity = otherReferencedAssembly.Identity;

                    if (AssemblyIdentityComparer.SimpleNameComparer.Equals(identity.Name, otherIdentity.Name) &&
                        (symbol.AssemblyVersionPattern ?? symbol.Identity.Version).Equals(otherReferencedAssembly.AssemblyVersionPattern ?? otherReferencedAssembly.Identity.Version) &&
                        AssemblyIdentity.EqualIgnoringNameAndVersion(identity, otherIdentity))
                    {
                        return(otherReferencedAssembly);
                    }
                }

                return(null);
            }
Ejemplo n.º 2
0
            private static bool IdentityEqualIgnoringVersionWildcard(AssemblySymbol left, AssemblySymbol right)
            {
                var leftIdentity  = left.Identity;
                var rightIdentity = right.Identity;

                return(AssemblyIdentityComparer.SimpleNameComparer.Equals(leftIdentity.Name, rightIdentity.Name) &&
                       (left.AssemblyVersionPattern ?? leftIdentity.Version).Equals(right.AssemblyVersionPattern ?? rightIdentity.Version) &&
                       AssemblyIdentity.EqualIgnoringNameAndVersion(leftIdentity, rightIdentity));
            }