-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Чечулин Антон #195
base: master
Are you sure you want to change the base?
Чечулин Антон #195
Conversation
_ => new DefaultColorGenerator(settings.Color), | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если честно, не очень понял, как сделать так, чтобы создавался именно нужный генератор цветов, надеюсь подскажешь, а то тут как-то не очень красиво
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Предлагаю вместо класса ColorGenerator использовать фабрику (класс, который содержит метод Create, возвращающий IColorGenerator по настройкам)
"doc" => new DocReader(), | ||
"docx" => new DocxReader(), | ||
_ => throw new ArgumentException($"File with extension {extension} doesn't supported") | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То же самое про создание нужного FileReader
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
FileName = fileName; | ||
FileFormat = fileFormat; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эти настройки и некоторые другие тоже прокидываю в несколько мест, не знаю насколько это хорошо
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
TagsCloudVisualization/Program.cs
Outdated
var options = Parser.Default.ParseArguments<CommandLineOptions>(args).Value; | ||
var builder = new ContainerBuilder(); | ||
|
||
builder.RegisterType<FileSettings>().WithParameters(new[] |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
TagsCloudVisualization/Program.cs
Outdated
var container = builder.Build(); | ||
var tagsLayouter = container.Resolve<ITagLayouter>(); | ||
var visualizer = container.Resolve<IVisualizer>(); | ||
var imageSaver = container.Resolve<IImageSaver>(); | ||
var tags = tagsLayouter.GetTags(); | ||
var image = visualizer.Vizualize(tags); | ||
imageSaver.SaveImage(image); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Давай попробуем организовать код таким образом, чтобы по минимуму вызывать метод Resolve
FileName = fileName; | ||
FileFormat = fileFormat; | ||
} | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
_ => new DefaultColorGenerator(settings.Color), | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Предлагаю вместо класса ColorGenerator использовать фабрику (класс, который содержит метод Create, возвращающий IColorGenerator по настройкам)
"doc" => new DocReader(), | ||
"docx" => new DocxReader(), | ||
_ => throw new ArgumentException($"File with extension {extension} doesn't supported") | ||
}; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Console.WriteLine(e.Message); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ещё не знаю, выполнены ли дополнительные требования. Когда будешь смотреть, отпишись пожалуйста, все ли сделано
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Выполнены, всё ок)
|
||
public Color GetColorIfMatch() | ||
{ | ||
var generator = colorGenerators.Where(g => g.Match()).FirstOrDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше определять генератор в методе Vizualize и в него передавать настройки. логично, что один набор тегов будет отрисовываться с одинаковыми настройками, нет смысла на каждый тег выполнять это действие
@elizShtol