예제 #1
0
        protected override void OnStart(string[] args)
        {
            try
            {
                ParserPool parserPool = new ParserPool();

                ParserSection config = (ParserSection)System.Configuration.ConfigurationManager.GetSection("parsers");
                foreach (var parserConfig in config.Instances)
                {
                    var cfg = (ParserInstanceElement)parserConfig;
                    if (cfg.Enabled)
                    {
                        try
                        {
                            parserPool.Add(cfg.Name, cfg.Class, cfg.BaseUrl, cfg.Country);
                        }
                        catch (Exception e)
                        {
                            Log.Instance.ErrorException("Could not initilialize " + cfg.Name + " parser", e);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Instance.FatalException("Could not start service", e);
            }
        }