public void Run(string[] args)
        {
            var ui          = new CLI(args);
            var appSettings = ui.ApplicationSettings;
            var words       = reader.ReadWords(appSettings.InputPath);

            words = formattingComponent.FormatWords(words);
            var generator = new TagsCloudGenerator
                                (wordsSizer, layouterFactory.CreateTagsCloudLayouter(appSettings.TagsCloudCenter, tagsCloudFactory));

            boringWordsRepository.LoadWords(appSettings.BlackListPath);
            words = filteringComponent.FilterWords(words);
            var cloud = generator.CreateCloud(words, appSettings.ImageSettings.LetterSize);

            renderer.RenderIntoFile(appSettings.ImageSettings, colorManager, cloud);
        }
Example #2
0
        public Result <None> Run(string[] args)
        {
            var ui          = new CLI(args);
            var appSettings = ui.ApplicationSettings;
            var generator   = new TagsCloudGenerator
                                  (wordsSizer, layouterFactory.CreateTagsCloudLayouter(appSettings.TagsCloudCenter, tagsCloudFactory));

            var result = boringWordsRepository.LoadWords(appSettings.BlackListPath)
                         .Then(x => reader.ReadWords(appSettings.InputPath))
                         .Then(words => formattingComponent.FormatWords(words))
                         .Then(words => filteringComponent.FilterWords(words))
                         .Then(words => generator.CreateCloud(words, appSettings.ImageSettings.LetterSize))
                         .Then(tagsCloud => renderer.RenderIntoFile(appSettings.ImageSettings, colorManager, tagsCloud));

            if (!result.IsSuccess)
            {
                Console.WriteLine(result.Error);
            }

            return(result);
        }