private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            // First, trigger a resolve event and see if we found a matching Assembly.
            // This will give core and editor plugin managers to load plugin Assemblies
            // their own way, or resolve with an already loaded one.
            if (this.AssemblyResolve != null)
            {
                AssemblyResolveEventArgs resolveArgs = new AssemblyResolveEventArgs(args.Name);
                this.AssemblyResolve(this, resolveArgs);

                if (resolveArgs.IsResolved)
                {
                    return(resolveArgs.ResolvedAssembly);
                }
            }

            // Admit that we didn't find anything.
            if (args.RequestingAssembly != null)
            {
                Log.Core.WriteWarning(
                    "Can't resolve Assembly '{0}' (as requested by '{1}'): None of the available assembly paths matches the requested name.",
                    args.Name,
                    Log.Assembly(args.RequestingAssembly));
            }
            else
            {
                Log.Core.WriteWarning(
                    "Can't resolve Assembly '{0}': None of the available assembly paths matches the requested name.",
                    args.Name);
            }
            return(null);
        }
示例#2
0
        private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            // First, trigger a resolve event and see if we found a matching Assembly.
            // This will give core and editor plugin managers to load plugin Assemblies
            // their own way, or resolve with an already loaded one.
            if (this.AssemblyResolve != null)
            {
                AssemblyResolveEventArgs resolveArgs = new AssemblyResolveEventArgs(args.Name);
                this.AssemblyResolve(this, resolveArgs);

                if (resolveArgs.IsResolved)
                {
                    return(resolveArgs.ResolvedAssembly);
                }
            }

            // Admit that we didn't find anything - unless it's a resource Assembly, which
            // is used for WinForms localization. Not finding them is the default / expected.
            bool isResourceAssembly = false;

            if (args.Name != null)
            {
                string token        = ".resources";
                int    index        = args.Name.IndexOf(token);
                int    pastEndIndex = index + token.Length;
                if (index != -1 && (pastEndIndex >= args.Name.Length || args.Name[pastEndIndex] == ','))
                {
                    isResourceAssembly = true;
                }
            }
            if (!isResourceAssembly)
            {
                if (args.RequestingAssembly != null)
                {
                    Logs.Core.WriteWarning(
                        "Can't resolve Assembly '{0}' (as requested by '{1}'): None of the available assembly paths matches the requested name.",
                        args.Name,
                        LogFormat.Assembly(args.RequestingAssembly));
                }
                else
                {
                    Logs.Core.WriteWarning(
                        "Can't resolve Assembly '{0}': None of the available assembly paths matches the requested name.",
                        args.Name);
                }
            }
            return(null);
        }
示例#3
0
 public Assembly InvokeResolveAssembly(string fullAssemblyName)
 {
     AssemblyResolveEventArgs resolveArgs = new AssemblyResolveEventArgs(fullAssemblyName);
     this.AssemblyResolve(this, resolveArgs);
     return resolveArgs.ResolvedAssembly;
 }
示例#4
0
        private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            // First, trigger a resolve event and see if we found a matching Assembly.
            // This will give core and editor plugin managers to load plugin Assemblies
            // their own way, or resolve with an already loaded one.
            if (this.AssemblyResolve != null)
            {
                AssemblyResolveEventArgs resolveArgs = new AssemblyResolveEventArgs(args.Name);
                this.AssemblyResolve(this, resolveArgs);

                if (resolveArgs.IsResolved)
                    return resolveArgs.ResolvedAssembly;
            }

            // Admit that we didn't find anything.
            if (args.RequestingAssembly != null)
            {
                Log.Core.WriteWarning(
                    "Can't resolve Assembly '{0}' (as requested by '{1}'): None of the available assembly paths matches the requested name.",
                    args.Name,
                    Log.Assembly(args.RequestingAssembly));
            }
            else
            {
                Log.Core.WriteWarning(
                    "Can't resolve Assembly '{0}': None of the available assembly paths matches the requested name.",
                    args.Name);
            }
            return null;
        }