-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use top-level statements for Blazor app
- Loading branch information
1 parent
5fc3505
commit fef79ff
Showing
2 changed files
with
38 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,44 @@ | ||
using ClashOfClans.Core; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.PlatformAbstractions; | ||
|
||
namespace ClashOfClans.Blazor | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddRazorPages(); | ||
builder.Services.AddServerSideBlazor(); | ||
builder.Services.AddClashOfClans(options => | ||
{ | ||
var clashOptions = new ClashOfClansOptionsV2(); | ||
builder.Configuration.GetSection(ClashOfClansOptions.ClashOfClans).Bind(clashOptions); | ||
options.Tokens.AddRange(clashOptions.Tokens); | ||
options.MaxRequestsPerSecond = clashOptions.MaxRequestsPerSecond; | ||
}); | ||
|
||
var app = builder.Build(); | ||
|
||
if (app.Environment.IsDevelopment()) | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureAppConfiguration((hostingContext, config) => | ||
{ | ||
config.SetBasePath(PlatformServices.Default.Application.ApplicationBasePath); | ||
}) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} | ||
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.UseAuthorization(); | ||
|
||
app.MapDefaultControllerRoute(); | ||
app.MapRazorPages(); | ||
app.MapBlazorHub(); | ||
|
||
app.Run(); |
This file was deleted.
Oops, something went wrong.