コード例 #1
0
        public AssemblyProxy LoadAssembly(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            path = ResolvePath(path);

            var foundAssembly = (from asm in _assemblies.Keys where asm.Location == path select asm).FirstOrDefault();

            if (foundAssembly != null)
            {
                return(_assemblies[foundAssembly]);
            }

            AssemblyProxy proxy = null;

            if (File.Exists(path))
            {
                var assembly = Assembly.LoadFrom(path);

                assembly.ModuleResolve += HandleModuleResolve;

                return(MakeAssemblyProxy(assembly));
            }
            else
            {
                this.Callback.WriteError("File does not exist : \"{0}\"", path);
            }

            return(proxy);
        }
コード例 #2
0
        private TypeProxy MakeTypeProxy(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            AssemblyProxy proxy = MakeAssemblyProxy(type.Assembly);

            return(proxy.MakeTypeProxy(type));
        }
コード例 #3
0
 public bool Equals(AssemblyProxy other)
 {
     if (other == null)
     {
         return(false);
     }
     else if (Object.ReferenceEquals(this, other))
     {
         return(true);
     }
     else
     {
         return(_assembly.Equals(other._assembly));
     }
 }
コード例 #4
0
        internal AssemblyProxy MakeAssemblyProxy(Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            AssemblyProxy proxy = null;

            if (!_assemblies.TryGetValue(assembly, out proxy))
            {
                proxy = new AssemblyProxy(this._utils, assembly);

                _assemblies.Add(assembly, proxy);
            }

            return(proxy);
        }