예제 #1
0
        public bool SelectReflector(IHost host, bool force)
        {
            string path = GetReflector(host);
            string initDir;

            if (String.IsNullOrEmpty(path) || !File.Exists(path))
            {
                initDir = null;
            }
            else
            {
                if (!force && File.Exists(path))
                {
                    return(true);
                }
                initDir = Path.GetDirectoryName(path);
            }

            path = SimpleReflector.OpenReflector(initDir);
            if (!File.Exists(path))
            {
                return(false);
            }

            SetReflector(host, path);
            return(true);
        }
        Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            Assembly a = _coreAssemblyResolver.DefaultResolveEventHandler(sender, args);

            if (a != null)
            {
                return(a);
            }

            a = AssemblyUtils.ResolveAssemblyFile(args.Name, _form.TreeViewHandler.CurrentPath);
            if (a != null)
            {
                return(a);
            }

            if (args.Name.IndexOf("Reflector,") >= 0)
            {
                string path = SimpleReflector.OpenReflector();
                if (!String.IsNullOrEmpty(path))
                {
                    path = Path.GetDirectoryName(path);
                    AddAssemblyResolveDir(path);

                    a = AssemblyUtils.ResolveAssemblyFile(args.Name, path);
                    if (a != null)
                    {
                        return(a);
                    }
                }
            }

            if (_form.TextInfo != null && !IsResourcesAssembly(args.Name))
            {
                string message = "Could not resolve: " + args.Name;
                if (!_form.TextInfo.TextInfo.Contains(message))
                {
                    _form.TextInfo.AppendTextInfoLine(message);
                }
            }
            return(null);
        }