public TinfoilIndex Build(IEnumerable <Dir> dirs, TinfoilIndexType indexType, string?messageOfTheDay) { var tinfoilIndex = new TinfoilIndex { Success = messageOfTheDay, }; switch (indexType) { case TinfoilIndexType.Flatten: foreach (var dir in dirs) { AppendFlatten(dir, tinfoilIndex); } break; case TinfoilIndexType.Hierarchical: foreach (var dir in dirs) { AppendHierarchical(dir, tinfoilIndex); } break; default: throw new ArgumentOutOfRangeException(nameof(indexType), indexType, null); } return(tinfoilIndex); }
public TinfoilIndex Build(string directory, Uri correspondingUri, TinfoilIndexType indexType, string?messageOfTheDay) { var rooDirUri = correspondingUri.OriginalString.EndsWith('/') ? correspondingUri : new Uri(correspondingUri.OriginalString + "/"); var tinfoilIndex = new TinfoilIndex { Success = messageOfTheDay, }; switch (indexType) { case TinfoilIndexType.Flatten: var filePaths = Directory.GetFiles(directory, "*.*", SearchOption.AllDirectories); foreach (var filePath in filePaths) { if (!_fileFilter.IsFileAllowed(filePath)) { continue; } var relFilePath = filePath[directory.Length..];