public void AddAssembly(byte[] rawAssembly, bool encrypt = true, bool compress = true)
        {
            var embeddedAssembly = new EmbeddedAssembly();

            var assemblyRef = AssemblyReference.GetAssemblyName(PEImage.Load(rawAssembly, null));

            embeddedAssembly.Name   = assemblyRef.Name;
            embeddedAssembly.DataID = _storage.Add(rawAssembly, encrypt, compress);
            _assemblies.Add(embeddedAssembly);
        }
        internal static bool IsNuGetAssembly(AssemblyReference assemblyReference)
        {
            var assemblyName = assemblyReference.GetAssemblyName();

            var isNuGetAssembly = assemblyName.Name == null || NuGetAssembly.MatchesName(assemblyName.Name);

            // Originally I wanted to also check the strong name token, to reduce the risk that someone compiled their
            // code against a custom NuGet assembly with APIs that we don't ship. However, JetBrains compiled their
            // products against custom NuGet assemblies with a different public token, so we can't do that check if we
            // want to find out which APIs they're using.

            return(isNuGetAssembly);
        }
Exemple #3
0
 private static AssemblyNode OnAssemblyReferenceResolutionAfterProbingFailed(
     AssemblyReference assemblyReference, ModuleNode referencingModule)
 {
     return(AssemblyNode.GetAssembly(Assembly.Load(assemblyReference.GetAssemblyName().FullName).Location, true, false, true));
 }