Пример #1
0
        public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
        {
            var res = base.Resolve(name, parameters);

            if (res == null || res.FullName != name.FullName)
            {
                var defaultProfiles = _defaultProfileAssemblyIndex.Where(kv => CecilEqualityComparer.AreEqual(kv.Item1, name)).ToList();
                if (defaultProfiles.Any())
                {
                    var profile      = defaultProfiles.First().Item2;
                    var assemblyFile = Path.Combine(profile.Directory, name.Name + ".dll");
                    if (File.Exists(assemblyFile))
                    {
                        Trace.WriteLine(string.Format("Successfully resolved assembly {0} to profile {1}.", name, profile.Directory), "ReferenceSearchingMetadataResolver");
                        return(ModuleDefinition.ReadModule(assemblyFile, parameters).Assembly);
                    }
                    else
                    {
                        throw new Exception(string.Format("Assembly {0} doesn't exist.", assemblyFile));
                    }
                }
            }
            return(res);
        }
Пример #2
0
 public bool Equals(AttributeDependency other)
 {
     return((object)other != null && CecilEqualityComparer.AreEqual(other.DependingMember, this.DependingMember));
 }
Пример #3
0
 public override void Break()
 {
     Trace.WriteLine(String.Format("Removing attribute {0} from {1} because the attribute is being removed.", AttributeType, AttributedMember), "TypeDependency");
     AttributedMember.CustomAttributes.RemoveWhere(ca => CecilEqualityComparer.AreEqual(ca.AttributeType, AttributeType));
 }
Пример #4
0
 public bool Equals(TypeDependency other)
 {
     return((object)other != null && other.GetType() == this.GetType() && CecilEqualityComparer.AreEqual(other.DependingMember, this.DependingMember));
 }