Exemplo n.º 1
0
        private static bool InitializeBlacklist(IBlackList referrerBlacklist, string path)
        {
            ILoggingDataService loggingService = LoggingDataServiceFactory.GetService(SiteConfig.GetLogPathFromCurrentContext());

            try
            {
                referrerBlacklist.Initialize(path);
                BlacklistUpdateState updateState = referrerBlacklist.UpdateBlacklist();

                if (updateState == BlacklistUpdateState.Failed)
                {
                    loggingService.AddEvent(
                        new EventDataItem(EventCodes.Error, referrerBlacklist.ToString() + " could not be updated: ", "InitializeBlacklist"));
                }
                else if (updateState == BlacklistUpdateState.Updated)
                {
                    loggingService.AddEvent(
                        new EventDataItem(EventCodes.ApplicationStartup, referrerBlacklist.ToString() + " updated: ", "InitializeBlacklist"));
                }

                return(true);
            }
            catch (Exception ex)
            {
                loggingService.AddEvent(new EventDataItem(EventCodes.Error, referrerBlacklist.ToString() + " could not be initialized: " + ex.ToString(), "InitializeBlacklist"));
            }

            return(false);
        }
Exemplo n.º 2
0
		private static bool InitializeBlacklist(IBlackList referrerBlacklist, string path)
		{
			ILoggingDataService loggingService = LoggingDataServiceFactory.GetService(SiteConfig.GetLogPathFromCurrentContext());

			try
			{
				referrerBlacklist.Initialize(path);
				BlacklistUpdateState updateState = referrerBlacklist.UpdateBlacklist();
					
				if (updateState == BlacklistUpdateState.Failed)
				{
					loggingService.AddEvent(
						new EventDataItem(EventCodes.Error, referrerBlacklist.ToString() + " could not be updated: ", "InitializeBlacklist"));
				}
				else if (updateState == BlacklistUpdateState.Updated)
				{
					loggingService.AddEvent(
						new EventDataItem(EventCodes.ApplicationStartup, referrerBlacklist.ToString() + " updated: ", "InitializeBlacklist"));
				}
				
				return true;
			}
			catch (Exception ex)
			{
				loggingService.AddEvent(new EventDataItem(EventCodes.Error, referrerBlacklist.ToString() + " could not be initialized: " + ex.ToString(), "InitializeBlacklist"));
			}

			return false;
		}
Exemplo n.º 3
0
        public static void AddBlacklist(IBlackList blackList, string blacklist)
        {
            if (blacklists.ContainsKey(blackList.GetType().Name) == false)
            {
                try
                {
                    blackList.Initialize(blacklist);
                    blackList.UpdateBlacklist();
                    blacklists.Add(blackList.GetType().Name, blackList);
                }
                catch (Exception ex)
                {
                    Console.Write(ex.ToString());
                }
            }
            else
            {
                // update the blacklist
                IBlackList referrerBlacklist = blacklists[blackList.GetType().Name] as IBlackList;
                try
                {
                    referrerBlacklist.Initialize(blacklist);
                    BlacklistUpdateState updateState = referrerBlacklist.UpdateBlacklist();

                    if (updateState == BlacklistUpdateState.Failed)
                    {
                        new EventDataItem(EventCodes.Error, blackList.ToString() + " could not be updated: ", "");
                    }
                }
                catch (Exception ex)
                {
                    Console.Write(ex.ToString());
                }
            }
        }
Exemplo n.º 4
0
 public TagCloudRenderer(IWordExtractor wordExtractor, IBlackList blackList, ITagCloudVizualizer vizualizer,
                         WordCloudConfig wordCloudConfig)
 {
     this.wordExtractor   = wordExtractor;
     this.blackList       = blackList;
     this.vizualizer      = vizualizer;
     this.wordCloudConfig = wordCloudConfig;
 }
Exemplo n.º 5
0
 public TagClodForm(IWordExtractor wordExtractor, IBlackList blackList, ITagCloudVizualizer vizualizer, WordCloudConfig wordCloudConfig)
 {
     this.wordExtractor = wordExtractor;
     this.blackList     = blackList;
     this.vizualizer    = vizualizer;
     InitializeComponent();
     this.wordCloudConfig = wordCloudConfig;
     pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
 }
 public LowerTaxaInItalicTagger(
     IPersonNamesHarvester personNamesHarvester,
     IBlackList blacklist,
     IContentTagger contentTagger,
     ILogger logger)
 {
     this.personNamesHarvester = personNamesHarvester ?? throw new ArgumentNullException(nameof(personNamesHarvester));
     this.blacklist            = blacklist ?? throw new ArgumentNullException(nameof(blacklist));
     this.contentTagger        = contentTagger ?? throw new ArgumentNullException(nameof(contentTagger));
     this.logger = logger;
 }
Exemplo n.º 7
0
		public static void AddBlacklist(IBlackList blackList, string path)
		{
			if (blacklists.ContainsKey(blackList.GetType().Name) == false)
			{
				bool success = InitializeBlacklist(blackList, path);
				if (success) blacklists.Add(blackList.GetType().Name, blackList);
			}
			else
			{
                IBlackList referrerBlacklist = blacklists[blackList.GetType().Name];
				InitializeBlacklist(referrerBlacklist, path);
			}
		}
Exemplo n.º 8
0
 public HigherTaxaTagger(
     IHigherTaxaDataMiner miner,
     ITextContentHarvester contentHarvester,
     IPersonNamesHarvester personNamesHarvester,
     IBlackList blacklist,
     IWhiteList whitelist,
     IStringTagger contentTagger)
 {
     this.miner                = miner ?? throw new ArgumentNullException(nameof(miner));
     this.contentHarvester     = contentHarvester ?? throw new ArgumentNullException(nameof(contentHarvester));
     this.personNamesHarvester = personNamesHarvester ?? throw new ArgumentNullException(nameof(personNamesHarvester));
     this.blacklist            = blacklist ?? throw new ArgumentNullException(nameof(blacklist));
     this.whitelist            = whitelist ?? throw new ArgumentNullException(nameof(whitelist));
     this.contentTagger        = contentTagger ?? throw new ArgumentNullException(nameof(contentTagger));
 }
Exemplo n.º 9
0
 public static void AddBlacklist(IBlackList blackList, string path)
 {
     if (blacklists.ContainsKey(blackList.GetType().Name) == false)
     {
         bool success = InitializeBlacklist(blackList, path);
         if (success)
         {
             blacklists.Add(blackList.GetType().Name, blackList);
         }
     }
     else
     {
         IBlackList referrerBlacklist = blacklists[blackList.GetType().Name];
         InitializeBlacklist(referrerBlacklist, path);
     }
 }
Exemplo n.º 10
0
		public static void AddBlacklist(IBlackList blackList, string blacklist)
		{
			if (blacklists.ContainsKey(blackList.GetType().Name) == false)
			{
				try
				{
					blackList.Initialize(blacklist);
					blackList.UpdateBlacklist();
					blacklists.Add(blackList.GetType().Name, blackList);
				}
				catch (Exception ex)
				{
					Console.Write(ex.ToString());
				}
			}
			else
			{
				// update the blacklist
				IBlackList referrerBlacklist = blacklists[blackList.GetType().Name] as IBlackList;
				try
				{
					referrerBlacklist.Initialize(blacklist);
					BlacklistUpdateState updateState = referrerBlacklist.UpdateBlacklist();
					
					if (updateState == BlacklistUpdateState.Failed)
					{
						new EventDataItem(EventCodes.Error, blackList.ToString() + " could not be updated: ", "");
					}

				}
				catch (Exception ex)
				{
					Console.Write(ex.ToString());
				}
			}
		}
Exemplo n.º 11
0
 public static IEnumerable <string> Filter(this IEnumerable <string> terms, IBlackList blacklist)
 {
     return(terms.Where(term => !blacklist.Countains(term)));
 }
Exemplo n.º 12
0
 public ProxyProvider(IBlackList blackList, IParseMethodsProvider parseMethodProvider)
 {
     this.blackList = blackList;
     this.parseMethodProvider = parseMethodProvider;
 }
Exemplo n.º 13
0
 public ProxyProvider(IBlackList blackList, IParseMethodsProvider parseMethodProvider)
 {
     this.blackList           = blackList;
     this.parseMethodProvider = parseMethodProvider;
 }