Exemple #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);
        }
Exemple #2
0
 public override int GetHashCode()
 {
     return(this.GetType().GetHashCode() ^ CecilEqualityComparer.GetHashCode(DependingMember));
 }
Exemple #3
0
 public override int GetHashCode()
 {
     return(CecilEqualityComparer.GetHashCode(DependingMember) ^ CecilEqualityComparer.GetHashCode(AttributeType));
 }
Exemple #4
0
 public bool Equals(AttributeDependency other)
 {
     return((object)other != null && CecilEqualityComparer.AreEqual(other.DependingMember, this.DependingMember));
 }
Exemple #5
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));
 }
Exemple #6
0
 public bool Equals(TypeDependency other)
 {
     return((object)other != null && other.GetType() == this.GetType() && CecilEqualityComparer.AreEqual(other.DependingMember, this.DependingMember));
 }