internal Configuration(RootConfigSection RootConfig)
 {
     if (RootConfig == null)
     {
         throw new ArgumentNullException();
     }
     Depth     = (int)RootConfig.Depth.Value;
     Resources = RootConfig.RootResources;
 }
Esempio n. 2
0
 public override async void DoCraulingAsync(object obj)
 {
     try
     {
         canExecute = false;
         try
         {
             RootConfigSection config = System.Configuration.
                                        ConfigurationManager.GetSection(RootConfigSection.SECTION_NAME) as RootConfigSection;
             depth    = config.Depth.Value;
             rootUrls = config.RootResources;
         }
         catch
         {
             throw new Exception("Error in app.config!");
         }
         try
         {
             IWebCrawler webCrauler = new WebCrawler(depth, new Parser(), logger);
             UrlTree = await webCrauler.PerformCraulingAsync(rootUrls);
         }
         catch
         {
             throw new Exception("Error in WebCrawling");
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         resultException = ex;
         OnExceptionSet();// Is private property will be good at this case?
     }
     finally
     {
         canExecute = true;
     }
 }