Ejemplo n.º 1
0
        private static void RecurseLoadAddons(DirectoryInfo folder, string[] ignoredNames)
        {
            foreach (FileSystemInfo fileSystemInfo in folder.GetFileSystemInfos())
            {
                if (!((IEnumerable <string>)ignoredNames).Contains <string>(fileSystemInfo.Name.ToLower()
                                                                            .Replace(".dll", "")))
                {
                    if (fileSystemInfo is DirectoryInfo)
                    {
                        WCellAddonMgr.LoadAddons((DirectoryInfo)fileSystemInfo, ignoredNames);
                    }
                    else if (fileSystemInfo.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase))
                    {
                        bool flag = true;
                        foreach (Assembly coreLib in WCellAddonMgr.CoreLibs)
                        {
                            if (coreLib.FullName.Equals(fileSystemInfo.Name.Replace(".dll", ""),
                                                        StringComparison.CurrentCultureIgnoreCase))
                            {
                                LogManager.GetCurrentClassLogger().Warn(
                                    "The core Assembly \"" + fileSystemInfo.FullName +
                                    "\" has been found in the Addon folder where it does not belong.- When compiling custom Addons, please make sure to set 'Copy Local' of all core-references to 'False'!");
                                flag = false;
                                break;
                            }
                        }

                        if (flag)
                        {
                            WCellAddonMgr.LoadAddon((FileInfo)fileSystemInfo);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads an Addon from the given file.
        /// Returns null if file does not exist.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public WCellAddonContext LoadAndInitAddon(FileInfo file)
        {
            WCellAddonContext wcellAddonContext = WCellAddonMgr.LoadAddon(file);

            if (wcellAddonContext != null)
            {
                wcellAddonContext.InitAddon();
            }
            return(wcellAddonContext);
        }