/// <summary> /// Loads all dictionary (.dic) files from the specified directory and returns a Dictionary object that contains the loaded data. /// </summary> /// <param name="directory">The directory from which to load dictionaries.</param> /// <param name="filter">Indicates whether dictionary entries marked with the #nsfw flag should be loaded.</param> /// <returns></returns> public static RantDictionary FromDirectory(string directory, NsfwFilter filter) { return(new RantDictionary(Directory.GetFiles(directory, "*.dic", SearchOption.AllDirectories).Select(file => RantDictionaryTable.FromFile(file, filter)).ToList())); }
/// <summary> /// Loads all dictionary (.dic) files from the specified directories and returns a Dictionary object that contains the loaded data. /// </summary> /// <param name="directories">The directories from which to load dictionaries.</param> /// <param name="filter">Indicates whether dictionary entries marked with the #nsfw flag should be loaded.</param> /// <returns></returns> public static RantDictionary FromMultiDirectory(string[] directories, NsfwFilter filter) { return(new RantDictionary(directories.SelectMany(path => Directory.GetFiles(path, "*.dic", SearchOption.AllDirectories)).Select(file => RantDictionaryTable.FromFile(file, filter)))); }
/// <summary> /// Loads all dictionary (.dic) files from the specified directories and returns a Dictionary object that contains the loaded data. /// </summary> /// <param name="directories">The directories from which to load dictionaries.</param> /// <param name="mergeBehavior">The merging strategy to employ.</param> /// <returns></returns> public static RantDictionary FromMultiDirectory(string[] directories, TableMergeBehavior mergeBehavior) { return(new RantDictionary(directories.SelectMany(path => Directory.GetFiles(path, "*.dic", SearchOption.AllDirectories)).Select(file => RantDictionaryTable.FromFile(file)), mergeBehavior)); }