Beispiel #1
0
        bool IAssemblySymbol.GivesAccessTo(IAssemblySymbol assemblyWantingAccess)
        {
            if (Equals(this, assemblyWantingAccess))
            {
                return(true);
            }

            var myKeys = GetInternalsVisibleToPublicKeys(assemblyWantingAccess.Name);

            // We have an easy out here. Suppose the assembly wanting access is
            // being compiled as a module. You can only strong-name an assembly. So we are going to optimistically
            // assume that it is going to be compiled into an assembly with a matching strong name, if necessary.
            if (myKeys.Any() && assemblyWantingAccess.IsNetModule())
            {
                return(true);
            }

            foreach (var key in myKeys)
            {
                IVTConclusion conclusion = this.Identity.PerformIVTCheck(assemblyWantingAccess.Identity.PublicKey, key);
                Debug.Assert(conclusion != IVTConclusion.NoRelationshipClaimed);
                if (conclusion == IVTConclusion.Match || conclusion == IVTConclusion.OneSignedOneNot)
                {
                    return(true);
                }
            }

            return(false);
        }