Пример #1
0
 public DashboardHub(DarkStatsDbContext darkStatsDbContext, SettingsLib settings, IHubContext <DashboardHub> clients)
 {
     _context  = darkStatsDbContext;
     _settings = settings;
     _clients  = clients;
     _context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
 }
Пример #2
0
 public Dashboard(DarkStatsDbContext darkStatsDbContext, SettingsLib settings, IHubContext <DashboardHub> clients)
 {
     _context  = darkStatsDbContext;
     _settings = settings;
     _clients  = clients;
     DashboardScrape.DataGathered += DataGatheredEvent;
     Scraper.ScrapeSaved          += ScrapeSavedEvent;
     _context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
 }
Пример #3
0
 public static void Main(string[] args)
 {
     if (args.Length == 1)
     {
         _listenUrl = args[0];
         Console.WriteLine("Using listen address: " + _listenUrl);
     }
     Console.WriteLine("Starting DarkStatsCore ({0})...", SettingsLib.VersionInformation);
     using (var context = new DarkStatsDbContext())
     {
         context.Database.Migrate();
         var settings = new SettingsLib(context);
         if (!settings.InvalidSettings)
         {
             ScrapeTask.StartScrapeTask(settings.SaveTime, settings.Url);
         }
     }
     BuildWebHost(args).Run();
 }
Пример #4
0
        public static int Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                         .Enrich.FromLogContext()
                         .WriteTo.Console(theme: AnsiConsoleTheme.Code, standardErrorFromLevel: LogEventLevel.Warning)
                         .CreateLogger();
            Serilog.Debugging.SelfLog.Enable(Console.Error);

            try
            {
                if (args.Length == 1)
                {
                    _listenUrl = args[0];
                    Log.Information("Using listen address: {ListenUrl}", _listenUrl);
                }
                Log.Information("Starting DarkStatsCore ({Version})...", SettingsLib.VersionInformation);
                using (var context = new DarkStatsDbContext())
                {
                    context.Database.Migrate();
                    var settings = new SettingsLib(context);
                    if (!settings.InvalidSettings)
                    {
                        ScrapeTask.StartScrapeTask(settings.SaveTime, settings.Url);
                    }
                }
                BuildWebHost(args).Run();
                return(0);
            }
            catch (Exception e)
            {
                Log.Fatal(e, "Host terminated unexpectedly");
                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Пример #5
0
 public SettingsPageModel(SettingsLib settings)
 {
     _settings = settings;
 }
Пример #6
0
 public IndexModel(SettingsLib settings)
 {
     _settings = settings;
     SaveTime  = _settings.SaveTime.TotalMilliseconds;
 }