Example #1
0
 public override Mono.Cecil.AssemblyDefinition Resolve(Mono.Cecil.AssemblyNameReference name)
 {
     try
     {
         return(base.Resolve(name));
     }
     catch { }
     return(null);
 }
Example #2
0
 public override Mono.Cecil.AssemblyDefinition Resolve(Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters)
 {
     try
     {
         return(base.Resolve(name, parameters));
     }
     catch { }
     return(null);
 }
Example #3
0
        /// <inheritdoc/>
        public override bool TryResolve(
            AssemblyIdentity identity,
            out IAssembly assembly)
        {
            var nameRef = new Mono.Cecil.AssemblyNameReference(identity.Name, identity.VersionOrNull);

            try
            {
                var asmDef = Resolver.Resolve(nameRef, Parameters);
                assembly = new ClrAssembly(asmDef, ReferenceResolver);
                return(true);
            }
            catch (Mono.Cecil.AssemblyResolutionException)
            {
                assembly = null;
                return(false);
            }
        }
Example #4
0
        public static BuildArtifact Get(byte[] data)
        {
            BuildArtifact art = new BuildArtifact();

            using (MemoryStream ms = new MemoryStream(data))
            {
                try
                {
                    Mono.Cecil.AssemblyDefinition    def  = Mono.Cecil.AssemblyDefinition.ReadAssembly(ms);
                    Mono.Cecil.AssemblyNameReference defn = Mono.Cecil.AssemblyNameDefinition.Parse(def.FullName);

                    art.Version    = defn.Version.ToString();
                    art.Name       = defn.Name;
                    art.IsAssembly = true;
                }
                catch
                {
                }
            }

            art.Data = data;

            return(art);
        }
Example #5
0
        static IEnumerable <Mono.Cecil.AssemblyNameReference> _loadGAC(uint dwFlags)
        {
            IApplicationContext applicationContext = null;
            IAssemblyEnum       assemblyEnum       = null;
            IAssemblyName       assemblyName       = null;

            Fusion.CreateAssemblyEnum(out assemblyEnum, null, null, dwFlags, 0);
            while (assemblyEnum.GetNextAssembly(out applicationContext, out assemblyName, 0) == 0)
            {
                uint nChars = 0;
                assemblyName.GetDisplayName(null, ref nChars, 0);
                StringBuilder name = new StringBuilder((int)nChars);
                assemblyName.GetDisplayName(name, ref nChars, 0);
                Mono.Cecil.AssemblyNameReference r = null;
                try { r = Mono.Cecil.AssemblyNameReference.Parse(name.ToString()); }
                catch (ArgumentException) { }
                catch (FormatException) { }
                catch (OverflowException) { }
                if (r != null)
                {
                    yield return(r);
                }
            }
        }
Example #6
0
 public StrongNameSuffix(Mono.Cecil.AssemblyNameReference name)
 {
     this.publicKeyToken = name.PublicKeyToken;
     this.version        = name.Version;
 }
 public Mono.Cecil.AssemblyDefinition Resolve(Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters)
 {
     return(null);
 }
 public Mono.Cecil.AssemblyDefinition Resolve(Mono.Cecil.AssemblyNameReference name)
 {
     return(null);
 }
Example #9
0
 public Mono.Cecil.AssemblyDefinition Resolve(Mono.Cecil.AssemblyNameReference reference,
                                              Mono.Cecil.ReaderParameters parameters)
 {
     return(ResolveAssemblyByLocation(GetReferenceLocation(reference.Name), parameters));
 }
Example #10
0
 public Mono.Cecil.AssemblyDefinition Resolve(Mono.Cecil.AssemblyNameReference name)
 {
     return(Resolve(name, new Mono.Cecil.ReaderParameters(Mono.Cecil.ReadingMode.Deferred)));
 }