예제 #1
0
        public StudioXPlugInManager()
        {
            PlugInSources = new PlugInSourceList();

            //TODO: Try to use AssemblyLoadContext.Default!
#if NET46
            RegisterToAssemblyResolve(PlugInSources);
#endif
        }
예제 #2
0
        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));
                };
            }
        }
 public static void AddFolder(this PlugInSourceList list, string folder,
                              SearchOption searchOption = SearchOption.TopDirectoryOnly)
 {
     list.Add(new FolderPlugInSource(folder, searchOption));
 }
 public static void AddTypeList(this PlugInSourceList list, params Type[] moduleTypes)
 {
     list.Add(new PlugInTypeListSource(moduleTypes));
 }