public bool CheckOnCorrectPlacement(string text)
        {
            ConfigurationHelper helper     = new ConfigurationHelper();
            WorkWithHooks       hook       = new WorkWithHooks();
            bool searchResult              = hook.CheckHooks(text, helper.GetDictionaryTokenInternal("BeginToken", "EndToken"));
            DataServiceContext dataService = new DataServiceContext();

            dataService.AddResultOfCheking(searchResult, hook.count);
            return(searchResult);
        }
Exemplo n.º 2
0
        public bool  CheckOnCorrectPlacement(string sourceType)
        {
            var container = ContainerConfig.Configure();

            using (var scope = container.BeginLifetimeScope())
            {
                var director = new Director();
                var builder  = new ConfigurationBuilder();
                director.ConfigurationBuilder = builder;

                var source = scope.ResolveNamed <ISource>(sourceType);
                director.BuildForSource(source);
                var config = builder.GetProduct();

                WorkWithHooks hook = new WorkWithHooks();
                string        text;
                try
                {
                    text = source.ReadSource(Console.ReadLine());
                }

                catch (Exception ex)
                {
                    Console.WriteLine($"{config.ExceptionText} {ex.Message}");
                    return(false);
                }
                bool searchResult = hook.CheckHooks(text, config.HooksStorage);
                try
                {
                    source.WriteToDestination(searchResult, hook.count);
                }

                catch (Exception ex)
                {
                    Console.WriteLine($"Описание ошибки при выводе результатов проверки:{ex.Message}");
                    return(false);
                }

                Console.WriteLine(text + "\n" + config.ListParts());
                return(searchResult);
            }
        }