<commit_before>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.IO;
using ReClassNET.Core;
using ReClassNET.Logger;
using ReClassNET.Native;
using ReClassNET.Util;

namespace ReClassNET.Plugins
{
	internal sealed class PluginManager
	{
		private readonly List<PluginInfo> plugins = new List<PluginInfo>();

		private readonly IPluginHost host;

		public IEnumerable<PluginInfo> Plugins => plugins;

		public PluginManager(IPluginHost host)
		{
			Contract.Requires(host != null);

			this.host = host;
		}

		public void LoadAllPlugins(string path, ILogger logger)
		{
			Contract.Requires(path != null);
			Contract.Requires(logger != null);

			try
			{
				if (!Directory.Exists(path))
				{
					return;
				}

				var directory = new DirectoryInfo(path);

				LoadPlugins(directory.GetFiles("*.dll"), logger, true);

				LoadPlugins(directory.GetFiles("*.exe"), logger, true);

				LoadPlugins(directory.GetFiles("*.so"), logger, false);
			}
			catch (Exception ex)
			{
				logger.Log(ex);
			}
		}

		private void LoadPlugins(IEnumerable<FileInfo> files, ILogger logger, bool checkProductName)
		{
			// TODO: How to include plugin infos for unix files as they don't have embedded version info.

			Contract.Requires(files != null);<commit_msg>Search plugins in all sub directories.<commit_after>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.IO;
using ReClassNET.Core;
using ReClassNET.Logger;
using ReClassNET.Native;
using ReClassNET.Util;

namespace ReClassNET.Plugins
{
	internal sealed class PluginManager
	{
		private readonly List<PluginInfo> plugins = new List<PluginInfo>();

		private readonly IPluginHost host;

		public IEnumerable<PluginInfo> Plugins => plugins;

		public PluginManager(IPluginHost host)
		{
			Contract.Requires(host != null);

			this.host = host;
		}

		public void LoadAllPlugins(string path, ILogger logger)
		{
			Contract.Requires(path != null);
			Contract.Requires(logger != null);

			try
			{
				if (!Directory.Exists(path))
				{
					return;
				}

				var directory = new DirectoryInfo(path);

				LoadPlugins(directory.GetFiles("*.dll", SearchOption.AllDirectories), logger, true);

				LoadPlugins(directory.GetFiles("*.exe", SearchOption.AllDirectories), logger, true);

				LoadPlugins(directory.GetFiles("*.so", SearchOption.AllDirectories), logger, false);
			}
			catch (Exception ex)
			{
				logger.Log(ex);
			}
		}

		private void LoadPlugins(IEnumerable<FileInfo> files, ILogger logger, bool checkProductName)
		{
			// TODO: How to include plugin infos for unix files as they don't have embedded version info.

			Contract.Requires(files != null);
{'fraction_non_alphanumeric': 0.10817655571635311, 'fraction_numerical': 0.0, 'mean_word_length': 4.1876172607879925, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2253478', 'n_tokens_mistral': 972, 'n_tokens_neox': 818, 'n_words': 211}