Example #1
0
        protected AbstractWorker(string cachePath, string subPath, string langPath, double rssUpdateInterval)
        {
            _subPath   = subPath;
            _cachePath = cachePath;
            _langPath  = langPath;

            Common.Logger = new FileLogger(GetType().Name);

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;

            Api = new PoeApi();

            if (!File.Exists(_subPath))
            {
                File.Create(_subPath).Close();
            }
            if (!File.Exists(_cachePath))
            {
                File.Create(_cachePath).Close();
            }
            if (!File.Exists(_langPath))
            {
                File.Create(_langPath).Close();
            }

            _langsDictionary           = ChatLanguage.LoadDictionary(_langPath);
            _rssSubscriber             = new RssSubscriber(_subPath, rssUpdateInterval);
            _rssSubscriber.RssUpdated += RssUpdated;

            var msg = $"{GetType()} loaded";

            Common.Logger?.LogInfo(msg);
            Console.WriteLine(msg);
        }
Example #2
0
 public void Load_NotFound()
 {
     using (var src = new RssSubscriber(Invoker.Vanilla))
     {
         src.FileName = GetSource("NotFound.json");
         src.Load();
         Assert.That(src.Count, Is.EqualTo(0));
     }
 }
Example #3
0
 public void Load_NotFound()
 {
     using (var src = new RssSubscriber {
         FileName = GetResultsWith("NotFound.json")
     })
     {
         src.Load();
         Assert.That(src.Count, Is.EqualTo(0));
     }
 }