Example #1
0
 // this code is borrowed from XamlSchemaContext
 internal bool AssemblySatisfiesReference(AssemblyName assemblyName)
 {
     if (this.wrappedReference.AssemblyName.Name != assemblyName.Name)
     {
         return(false);
     }
     if (this.wrappedReference.AssemblyName.Version != null && !this.wrappedReference.AssemblyName.Version.Equals(assemblyName.Version))
     {
         return(false);
     }
     if (this.wrappedReference.AssemblyName.CultureInfo != null && !this.wrappedReference.AssemblyName.CultureInfo.Equals(assemblyName.CultureInfo))
     {
         return(false);
     }
     byte[] requiredToken = this.wrappedReference.AssemblyName.GetPublicKeyToken();
     if (requiredToken != null)
     {
         byte[] actualToken = assemblyName.GetPublicKeyToken();
         if (!AssemblyNameEqualityComparer.IsSameKeyToken(requiredToken, actualToken))
         {
             return(false);
         }
     }
     return(true);
 }
 private static bool AssemblySatisfiesReference(AssemblyName assemblyName, AssemblyName reference)
 {
     if (reference.Name != assemblyName.Name)
     {
         return(false);
     }
     if ((reference.Version != null) && !reference.Version.Equals(assemblyName.Version))
     {
         return(false);
     }
     if ((reference.CultureInfo != null) && !reference.CultureInfo.Equals(assemblyName.CultureInfo))
     {
         return(false);
     }
     byte[] publicKeyToken = reference.GetPublicKeyToken();
     if (publicKeyToken != null)
     {
         byte[] curKeyToken = assemblyName.GetPublicKeyToken();
         if (!AssemblyNameEqualityComparer.IsSameKeyToken(publicKeyToken, curKeyToken))
         {
             return(false);
         }
     }
     return(true);
 }