Inheritance: BaseIndexer, IIndexer
Example #1
0
        public void InitCardigannIndexers(string path)
        {
            logger.Info("Loading Cardigann definitions from: " + path);

            try
            {
                if (!Directory.Exists(path))
                    return;

                DirectoryInfo d = new DirectoryInfo(path);

                foreach (var file in d.GetFiles("*.yml"))
                {
                    logger.Info("Loading Cardigann definition " + file.FullName);
                    string DefinitionString = File.ReadAllText(file.FullName);
                    CardigannIndexer idx = new CardigannIndexer(this, container.Resolve<IWebClient>(), logger, container.Resolve<IProtectionService>(), DefinitionString);
                    if (indexers.ContainsKey(idx.ID))
                    {
                        logger.Debug(string.Format("Ignoring definition ID={0}, file={1}: Indexer already exists", idx.ID, file.FullName));
                    }
                    else
                    {
                        indexers.Add(idx.ID, idx);
                        LoadIndexerConfig(idx);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Error while loading Cardigann definitions: "+ ex.Message);
            }
        }
Example #2
0
 public void DeleteIndexer(string name)
 {
     var indexer = GetIndexer(name);
     var configPath = GetIndexerConfigFilePath(indexer);
     File.Delete(configPath);
     if (indexer.GetType() == typeof(CardigannIndexer))
     {
         indexers[name] = new CardigannIndexer(this, container.Resolve<IWebClient>(), logger, container.Resolve<IProtectionService>(), ((CardigannIndexer)indexer).DefinitionString);
     }
     else
     {
         indexers[name] = container.ResolveNamed<IIndexer>(indexer.ID);
     }
 }