示例#1
0
 private void OnServerStart(IServer server)
 {
     server.SetApiControllers(typeof(CalcAPI));
     server.CustomRequestPreProcessor = CustomHeaderHandler;
     FeedbackbHelper  = new FeedbackHelper();
     SpecialtyParser  = new SpecialtyParser();
     ReparseScheduler = new ParserScheduler(SpecialtyParser, Config);
 }
示例#2
0
 public ParserScheduler(SpecialtyParser parser, CalcConfig config) : base(config.UpdateDelay)
 {
     Parser             = parser;
     CurrentWorkHandler = async() =>
     {
         if (Tools.CheckForInternetConnection())
         {
             await Parser.ReloadTables();
         }
         SetDelay(config.UpdateDelay);
     };
 }
示例#3
0
 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); }
 }