Exemplo 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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Automatically loads all Addons from the given folder, ignoring any sub-folders or files
 /// that are in ignoreString, seperated by semicolon.
 /// </summary>
 /// <param name="folderName">The dir to look in for the Addon-Assemblies.</param>
 /// <param name="ignoreString">eg.: MyDllFile; My2ndFileIsJustALib; AnotherAddonFile</param>
 public static void LoadAddons(string folderName, string ignoreString)
 {
     WCellAddonMgr.LoadAddons(new DirectoryInfo(folderName), ((IEnumerable <string>)ignoreString.Split(
                                                                  new char[1]
     {
         ';'
     }, StringSplitOptions.RemoveEmptyEntries))
                              .TransformArray <string, string>((Func <string, string>)(s => s.ToLower().Trim().Replace(".dll", ""))));
 }