FileTopicHelper.ConstructHierarchyByFilenamePrefix Method
- Namespace
- Kampute.DocToolkit.Support
- Assembly
- Kampute.DocToolkit.dll
Definition
Organizes file-backed topics into a hierarchy using delimited prefixes in file names.
public static IEnumerable<FileTopic> ConstructHierarchyByFilenamePrefix(IEnumerable<FileTopic> topics, char delimiter)Parameters
topicsIEnumerable<FileTopic>- The collection of file-backed topics to organize.
delimiterchar- The character used to separate hierarchy levels in file names.
Returns
- IEnumerable<FileTopic>
- An enumerable collection of FileTopic instances that represent the top-level topics in the hierarchy.
Exceptions
- ArgumentNullException
- Thrown when
topicsisnullor contains anulltopic. - ArgumentException
- Thrown when multiple topics have the same file name (without extension), regardless of directory path.

In this method, directories of files are ignored, and only the filenames are considered for hierarchy construction. This means that files with the same name but located in different directories will be treated as if they were in the same directory, and in such cases, an exception will be thrown.
Example file structure with
delimiter = '.':