Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Init();
            int i = 0;

            DSdata.Init();
            List <DSReplay> replays = new List <DSReplay>();

            using (var context = new DSReplayContext(_opt))
            {
                context.Database.EnsureCreated();
                i = context.DSReplays.Count();
                //replays = context.DSReplays.Include(p => p.DSPlayer).ToList();
            }

            DateTime t = DateTime.Now;

            //int done = 0;
            int done = DbDupFind.ScanAdd();

            //int done = DbDupFind.ScanNG();

            if (done > 0)
            {
                Program.SendUpdateRequest();
            }

            DSdata.ServerConfig.LastRun = t;
            Program.SaveConfig();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
            DSdata.Init();
            app.ApplicationServices.GetService <LoadData>().Init();
            app.ApplicationServices.GetService <LoadData>().DataLoaded += Update;

            string basePath = Environment.GetEnvironmentVariable("ASPNETCORE_BASEPATH");

            if (!string.IsNullOrEmpty(basePath))
            {
                app.Use((context, next) =>
                {
                    context.Request.Scheme = "https";
                    return(next());
                });

                app.Use((context, next) =>
                {
                    context.Request.PathBase = new PathString(basePath);
                    if (context.Request.Path.StartsWithSegments(basePath, out var remainder))
                    {
                        context.Request.Path = remainder;
                    }
                    return(next());
                });
            }
            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                //ForwardedHeaders = ForwardedHeaders.All
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapControllers();
                endpoints.MapFallbackToPage("/_Host");
            });
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            DSdata.Init();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }


            // app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            if (Status.isFirstRun)
            {
                Task.Run(() => { app.ApplicationServices.GetService <StartupBackgroundService>().StartAsync(new System.Threading.CancellationToken()); });
            }
            Task.Run(() => { paxgame.Init(); });
            Task.Run(async() =>
            {
                await Electron.WindowManager.CreateWindowAsync();
                await ElectronService.Resize();
                //DSdata.DesktopUpdateAvailable = await ElectronService.CheckForUpdate();
                //DSdata.DesktopUpdateAvailable = await ElectronService.CheckForUpdateAndNotify();
            });
        }