private Result <HashSet <string> > FormWords(string path, ReaderFinder readerFinder, Filter filter) { return(ReadWords(path, readerFinder) .Then(filter.FilterWords) .Then(wordConverter.ConvertWords) .Then(words => words.ToHashSet())); }
private Result <HashSet <string> > ReadWords(string path, ReaderFinder readerFinder) { return(File.Exists(path) .AsResult() .FailIf(e => !e, $"Файла {path} не существует") .Then(e => readerFinder.Find(path)) .Then(reader => reader.ReadWords(path)) .Then(words => words.ToHashSet()) .OnFail(HandleError)); }
public ApplicationCore(ReaderFinder readerFinder, IImageBuilder tagCloudImageBuilder, ILayoutAlgorithm layoutAlgorithm, IImageSaver imageSaver, Filter filter, WordConverter wordConverter) { this.filter = filter; this.wordConverter = wordConverter; this.readerFinder = readerFinder; this.tagCloudImageBuilder = tagCloudImageBuilder; this.imageSaver = imageSaver; this.layoutAlgorithm = layoutAlgorithm; }
private Result <HashSet <string> > FormBoringWords(string path, ReaderFinder readerFinder, Filter filter) { return(path == null ? Result.Ok(new HashSet <string>()) : FormWords(path, readerFinder, filter)); }