private void OnServerStart(IServer server) { server.SetApiControllers(typeof(CalcAPI)); server.CustomRequestPreProcessor = CustomHeaderHandler; FeedbackbHelper = new FeedbackHelper(); SpecialtyParser = new SpecialtyParser(); ReparseScheduler = new ParserScheduler(SpecialtyParser, Config); }
public ParserScheduler(SpecialtyParser parser, CalcConfig config) : base(config.UpdateDelay) { Parser = parser; CurrentWorkHandler = async() => { if (Tools.CheckForInternetConnection()) { await Parser.ReloadTables(); } SetDelay(config.UpdateDelay); }; }
public async Task LoadCache() { try { var file = Path.Combine(Core.DirectoryManager[Dirs.Cache], "all.json"); if (File.Exists(file)) { using (var t = File.OpenText(file)) { SpecialtyParser.LoadSpecialtyList(JsonConvert.DeserializeObject <List <SpecialtyInfo> >(await t.ReadToEndAsync())); } } } catch (Exception ex) { Get.Core.Logger.NotifyError(LogArea.Other, ex); } }