/// <summary> /// Searches for a compatible entry-point in every compatible plugin file found in the specified directory, and call its <see cref="IEntrypoint.Setup">Setup</see> method. /// </summary> /// <param name="path">Either the path of a directory or an existing file.</param> /// <param name="options">Options for the plugins loader.</param> /// <param name="pattern">Pattern to search for in the name of the files within the directory, if a directory path was supplied.</param> public static void LoadPlugins(this IExpandR expandr, string path, PluginLoaderOptions options = default, string pattern = DefaultDirPattern) { if (File.Exists(path)) { expandr.LoadPlugin(new FileInfo(Path.GetDirectoryName(path)), options); } else { expandr.LoadPlugins(new DirectoryInfo(path), options, pattern); } }
/// <summary> /// Searches for a compatible entry-point in every compatible plugin file found in the specified directory, and call its <see cref="IEntrypoint.Setup">Setup</see> method. /// </summary> /// <param name="directory">The plugin assemblies directory, that are loaded via reflection after being sorted alphabetically.</param> /// <param name="pattern">Pattern to search for in the name of the files within the directory.</param> public static void LoadPlugins(this IExpandR expandr, DirectoryInfo directory, string pattern) => expandr.LoadPlugins(directory, default, pattern);