public SharePlatformPlugInManager()
        {
            PlugInSources = new PlugInSourceList();

            //TODO: 尝试使用assemblyloadcontext.default..?
            RegisterToAssemblyResolve(PlugInSources);
        }
        private static void RegisterToAssemblyResolve(PlugInSourceList plugInSources)
        {
            if (_isRegisteredToAssemblyResolve)
            {
                return;
            }

            lock (SyncObj)
            {
                if (_isRegisteredToAssemblyResolve)
                {
                    return;
                }

                _isRegisteredToAssemblyResolve = true;

                AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
                {
                    return(plugInSources.GetAllAssemblies().FirstOrDefault(a => a.FullName == args.Name));
                };
            }
        }
Exemplo n.º 3
0
 public static void AddFolder(this PlugInSourceList list, string folder, SearchOption searchOption = SearchOption.TopDirectoryOnly)
 {
     list.Add(new FolderPlugInSource(folder, searchOption));
 }
Exemplo n.º 4
0
 public static void AddTypeList(this PlugInSourceList list, params Type[] moduleTypes)
 {
     list.Add(new PlugInTypeListSource(moduleTypes));
 }