public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
        {
            LibLoader.SetupAssemblyFilenames();

            if (name.Name == CurrentAssemblyName)
            {
                return(AssemblyDefinition.ReadAssembly(CurrentAssemblyPath, parameters));
            }

            if (LibLoader.FilenameLocations.TryGetValue($"{name.Name}.dll", out var path))
            {
                if (File.Exists(path))
                {
                    return(AssemblyDefinition.ReadAssembly(path, parameters));
                }
            }
            else if (LibLoader.FilenameLocations.TryGetValue($"{name.Name}.{name.Version}.dll", out path))
            {
                if (File.Exists(path))
                {
                    return(AssemblyDefinition.ReadAssembly(path, parameters));
                }
            }


            return(base.Resolve(name, parameters));
        }
        public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
        {
            LibLoader.SetupAssemblyFilenames();

            var testFile = $"{name.Name}.{name.Version}.dll";

            if (LibLoader.FilenameLocations.TryGetValue(testFile, out string path))
            {
                if (File.Exists(path))
                {
                    return(AssemblyDefinition.ReadAssembly(path, parameters));
                }
            }

            return(base.Resolve(name, parameters));
        }
Example #3
0
        public BSIPALoaderPlugin()
        {
            try
            {
                AppDomain.CurrentDomain.AssemblyResolve += IPALoaderAssemblyResolve;

                EnsureDirectories();
                LibLoader.Configure();
                PluginLoader.LoadTask();
            }
            catch (Exception ex)
            {
                Logger.LogFatal("Fatal error trying to load BSIPA");
                Logger.LogFatal(ex);
            }
        }