public static IParserController GetController <ResultType>(string url, string source, ParserSettings settings, ParserType parserType) where ResultType : class
 {
     if (typeof(ResultType) == typeof(DataTable))
     {
         try
         {
             return(new StringParserController(
                        url, source, settings, parserType)
                    as IParserController);
         }
         catch (NullReferenceException ex)
         {
             throw ex;
         }
     }
     else
     {
         throw new NotSupportedException("Не поддерживаемый тип парсера!");
     }
 }
Example #2
0
 public StringParser(ParserSettings settings)
 {
     Settings = settings;
 }
Example #3
0
 public AgilityPackParser(ParserSettings settings)
 {
     Settings       = settings;
     _document      = new HtmlDocument();
     _stringBuilder = new StringBuilder();
 }
Example #4
0
 public AngleSharpParser(ParserSettings settings)
 {
     Settings = settings;
 }
Example #5
0
 public static IParserController <ResultType> GetController <ResultType>(string url, string source, ParserSettings settings) where ResultType : class
 {
     if (typeof(ResultType) == typeof(Dictionary <string, List <StringDictionary> >))
     {
         try
         {
             return(new StringParserController(
                        url, source, settings,
                        new ParserDataController <Tag, TagAttribute, HttpResponce, Parsing>(
                            new ParserRepository <Tag>(_contect) as IRepository <Tag>,
                            new ParserRepository <TagAttribute>(_contect) as IRepository <TagAttribute>,
                            new ParserRepository <HttpResponce>(_contect) as IRepository <HttpResponce>,
                            new ParserRepository <Parsing>(_contect) as IRepository <Parsing>
                            )
                        as IDataController <Dictionary <string, List <StringDictionary> > >)
                    as IParserController <ResultType>);
         }
         catch (NullReferenceException ex)
         {
             throw ex;
         }
     }
     else
     {
         throw new NotSupportedException("Не поддерживаемый тип парсера!");
     }
 }
Example #6
0
 public StringParserController(string url, string source, ParserSettings settings, IDataController <Dictionary <string, List <StringDictionary> > > dataController)
     : this(url, source, settings)
 {
     _dataController = dataController;
 }