Exemple #1
0
        static void Main(string[] args)
        {
            var cli = new CommandLineInterface(args);

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterInstance(cli.FileReaderSettings).As <FileReaderSettings>();
            containerBuilder.RegisterInstance(cli.LayouterSettings).As <CircularLayouterSettings>();
            containerBuilder.RegisterInstance(cli.DrawerSettings).As <DrawerSettings>();
            containerBuilder.RegisterInstance(cli.SaverSettings).As <SaverSettings>();
            containerBuilder.RegisterInstance(new BoringWordFilter(cli.BoringWords)).As <IWordFilter>();
            containerBuilder.RegisterInstance(new GramPartsFilter(cli.GramParts)).As <IWordFilter>();

            containerBuilder.RegisterType <WordNormalizer>().As <IWordNormalizer>();
            containerBuilder.RegisterType <WordsAnalyzer.WordsAnalyzer>().As <IWordsAnalyzer>();
            containerBuilder.RegisterType <CircularCloudLayouter>().As <IRectangleLayouter>();
            containerBuilder.RegisterType <FileReader>().As <ITextReader>();
            containerBuilder.RegisterType <ImageSaver>().As <IImageSaver>();
            containerBuilder.RegisterType <TagDrawer>().As <ITagDrawer>();

            containerBuilder.RegisterType <TagCloud>().AsSelf();

            var container = containerBuilder.Build();

            var tagCloud = container.Resolve <TagCloud>();

            tagCloud.MakeTagCloud();
        }
Exemple #2
0
        public static int Main(string[] args)
        {
            var CLI = new CommandLineInterface();

            CLI.ConfigureCLI(app);
            var executionResult = app.Execute(args);

            if (executionResult == 0)
            {
                return(0);
            }
            ConfigureServices(CLI.CanvasSize, CLI.BackgroundType, CLI.FileName);

            var visualizer = serviceProvider.GetService <IVisualizer>();
            var pathToPng  = visualizer.Visualize(CLI.FileName, CLI.StringFont, CLI.StringColor);

            Console.WriteLine("Result saved to:\n" + pathToPng);

            return(0);
        }